Handle process.exit to give the logger time to write the log