Cleanup and log when the process is waiting