installs custom cleanup handlers that run on exiting node