Cleaned up process finish.

Made sure everything was properly terminating on process exit, and that
we could restart the process after it had previously finished.