Bugfixes around connection handling.

Properly disconnect after auth fail, so that we can log in again.
Don't reset the connection when logging out (not necessary).