DRYing up process closedown logic
Merge branch 'close_tmp_files_on_stop'