rather than the user breaking into the program to stop it, perhaps just a daemon that periodically (say once a minute) checks an input queue where you can have a client script send some sort of commands into. then the daemon upon reading a stop command takes the proper set of steps to terminate without other direct action by user.