Part 2 to making forkProcess exception-safe.

The previous patch fixed exception safety inside the exception handlers
of the spawned process. This time, we prevent exceptions from causing
resources (such as processes) to leak if the caller `forkProcess` itself
receives an exception (note that the caller is not always the node
agent thread).