The graceful shutdown handler for loop-based operating NodeJS apps.