Run some code when the process exits