Changed to allow sending the quit message to the server before closing the connection. Should check for quit message server side.