if no history then back button closes window