make shutdown synchronous, and call it on process 'exit' events