Deal more sensibly with KeyboardInterrupt
The desired interface is that the user can terminate the process cleanly with
Ctrl-c. This can, however, interrupt a plot or calculation in a critical state, corrupting data, or worse, causing a seg-fault.
We should provide an option to replace the
signal.SIGINT handler and use this to close threads etc. in a good place to prevent hangs, etc.