Handle all keyboard interrupts more completely

Also handle abruptly closed pipe gracefully.