Fixed crash when closing before logged in