ENH: updated signal handler to handle interupts in the middle of a running process