fix bug with unclosed connection after logout