title: mssql function won't stop in node
body: <p>I created a mssql DB query function file for my project and the following function won't stop.</p>
  
  <p>After few checks, I can tell that the function return a valid value and the program keep running.</p>
  
  <p>After a while I understood/think than the sql connection is still open after returning the value.</p>
  
  <p>function file:</p>
  
  <pre><code>module.exports.dbquery = function (query){
      var sql = require('mssql')
      var config = {
          user:'user',
          password:'pass',
          server:'hostname',
          database:'DB'
      }
      return new Promise((resolve, reject) =&gt;{
          sql.connect(config, function(err){
              if(err){
                  console.log(err)
              }
              var request = sql.Request()
              request.query(query, function(err, recordset){
                  if(err){
                      console.log(err)
                  }
                  table = recordset.recordsets[0]
                  resolve(table)
              });
          });
      });
  }
  </code></pre>
  
  <p>How to close the connection or other wise what is the problem?</p>