Logout at close if the user logged in