Added case: Pressing Esc button closes the window.