Properly close files when destroying procs

I'm not 100% happy with this, but we're locking anyways, so we might as
well use it to prevent concurrent additions/modifications when we're
destroying the process.

This prevents us from sharing fgrps, which I'm okay with.

There are lots of races involved, check the comments for details.