Fixes T11592. This improves our ability to clean up subprocess trees:
- When killing a subprocess, send it SIGTERM first. If that doesn't work, wait a little while and send it SIGKILL.
- When exiting via __destruct() (for example, in response to recieving SIGTERM ourselves) try to SIGTERM children. We wait a shorter period of time for them to exit in this case (5 seconds).