defer the pid delete so it happens even in a crash

the defer keyword sets the following function up as a 'exit step'
for the function its in.  its pretty rad.