Crash fix of logoff when connection still alive