catching the keyboard interrupt