Properly clean up when timing out on a keystroke listener

If we time out waiting for a keystroke listener, then exit the main
loop, and reset the DBus connections' main loop contexts becak to the
default loop.

https://bugzilla.gnome.org/show_big.cgi?id=707218