Move KeyboardInterrupt handler to __main__.