Resolved double "disconnect" message. Also fixes #6 on Linux