fix crash on close without logout