set up KeyboardInterrupt handler