Capture the KeyboardInterrupt exception