Cleanup before node exits.