title: Node.js mssql close open connection
body: <p>I am building an API integration application in Node.js using the "mssql" package. I have the data pulling from the third-party API, and stored in my SQL Server. However, my DB connection stays open forever and keeps my app running. Everything that I have tried ends the connection before the data can be stored. So, I can either store my data and keep the connection open forever, or end my connection and not store the data. The best that I have found is something like this answer: <a href="https://stackoverflow.com/a/45681751/5552707">https://stackoverflow.com/a/45681751/5552707</a>.</p>
  
  <p>And I have tried that in my app, which still kills my connection before data is stored:</p>
  
  <pre><code>sql.connect(sqlConfig).then(pool =&gt; {
  
      var request = new sql.Request(pool);
      var result = request.bulk(table, (err, result) =&gt; {
  
          if(err){
              console.log("fail. " + err);
              return;
          }
  
      })
  
  }).catch(err =&gt; {
      console.log('There was an error processing the request. ' + err);
  }).then(() =&gt; {
      console.log('done');
      process.exit(1);
  });
  </code></pre>
  
  <p>They docs don't explain how to do this, which is frustrating.</p>
  
  <p>Any ideas would be awesome!</p>
  
  <p>Thanks!</p>