When 'debug' is set, bufwinnr() displays an error message saying the thesaurus buffer is missing if the thesaurus window is closed. According to the documentation, this function returns -1 when a buffer's window can't be found. This value is checked for and acted upon properly, so there is no need for that error message, especially when it bothers people (#25)
On my system (Ubuntu 12.04 LTS), "sh" will result in the use of "dash". However, changeset 48372a4 introduced a substitution on line 8, which is not supported by dash, resulting in an error message. If the shell is changed to bash (which should be available on every system), everything works fine.