Fix Traymonitor does not close connections when login fails.

Fixes #303: Traymonitor does not close connections when login fails