temp fix for db hang issue.
Moved the shutdown logic to the server.js.