Edited so mongoose connection does not close, and created a config file which will store the db password
main.js throws proper error when unable to connect