Added process.on('exit') code handler