title: node Cron with callback getting Cannot enqueue Handshake after invoking quit error
body: <p>I am trying to query DB in particular interval. So I am using node corn. I am creating a connection every minute and close it once query completed. but it works only for a first minute, next minute it throws an error of Cannot enqueue Handshake after invoking quit, even I am using a callback. Some one correct what I am doing wrong</p>
  
  <p>app.js</p>
  
  <pre><code>var sController = require('./sController');
   cron.schedule('* * * * *',function(){
    console.log("I am running every minute");
    var params ="dddd";
    sController.updateDb(params,function(err,res){
    console.log("xxxx");
   });
  
  });
  </code></pre>
  
  <p>sController.js</p>
  
  <pre><code>var sModel = require('./smodel');
  var sController = function(){}
  
  sController.prototype.updateDb = function(params,callback){
      sModel.updateDb(params,function(res,err){
          if(res){
              console.log("kkk");
          }
          callback(err,res);
      });
  }
  module.exports = new sController();
  </code></pre>
  
  <p>smodel.js</p>
  
  <pre><code>var connection = mysql.createConnection(mysqlConfig);
  function mysqlConnect() {
      connection.connect();
  }
  function mysqlClose() {
      if(!connection._protocol._ended){
          connection.end();
      }
  }
  var sModel = function() {};
  
  sModel.prototype.updateDb = function(params,callback){
      updateDb(params, function(err, res) {
          callback(err,res);
      });
  };
  function updateDb(params,callback){
      var query = 'SELECT * from tablename';
      mysqlConnect();
      connection.query(query,function(err,rows,fields){
          if(!err){
              console.log(rows.length);
          }
           callback(err,rows);
      });
      mysqlClose();
  }
  
  module.exports = new sModel();
  </code></pre>