Logout on exit.

Now that ChatExchange needs logging out on exit, do so.
Merge changes from ChatExchange (master)