replace keypress with keydown for closing frame event.