Better fix for getting stuck when closing login dialog on startup