Prevent browser lockups by closing the session