Fix thread problem with fx and premature socket closing
Merge pull request #1 from stenver/fix_jf_chat_client

Indeed, I seem to have introduced a bug while modifying it the last time (the same bug that I warned you about in the lecture :-)). Well caught!