Smarter cleanup of forked process