response to key events so I can quit normally