Added a handler for KeyboardInterrupt.