Next pid locks

This makes ctrl-c and other program-canceled situations handled more  gracefully on Linux (and Windows - da2ce7).

Still not perfect (need to make signal handler low-level signal compatible_ but it clears the locks and program can be rund again easily.