title: Cannot enqueue Query after invoking quit
body: <p>According to the Node MySQL documentation (<a href="https://github.com/mysqljs/mysql#introduction" rel="nofollow noreferrer">https://github.com/mysqljs/mysql#introduction</a>):</p>
  
  <p><code>Every method you invoke on a connection is queued and executed in sequence.</code></p>
  
  <p>and</p>
  
  <p><code>Closing the connection is done using end() which makes sure all remaining queries are executed before sending a quit packet to the mysql server.</code></p>
  
  <p>Nevertheless, the code below doesn't work, because the <code>connection.end()</code> method is called before the SQL queries can run.  If I comment out the <code>connection.end()</code> line, it works, but the script hangs (doesn't close/end) when it completes, requiring me to hit ctrl-c to end it.</p>
  
  <p>If I move the MySQL <code>connection</code> object and the <code>connection.end()</code> call into the <code>lineReader.createInterface().on()</code> block, it works - the script correctly terminates at the end...but it's creating a new connection for every <code>INSERT</code> statement.</p>
  
  <p>It doesn't seem right to close and reconnect each time like that.  Am I misunderstanding the Node MySQL documentation?  Is there a better way?</p>
  
  <pre><code>let lineReader  = require('readline');
  let file        = require('fs');
  let mysql       = require('mysql');
  
  let connection  = mysql.createConnection({
      host: '127.0.0.1',
      port: 33060,
      user: 'homestead',
      password: 'secret',
      database: 'sentinel',
  });
  
  lineReader.createInterface({
          input: file.createReadStream('proxies/proxies.txt')
      }).on('line', function (line) {
          let ary = line.split(/[:, ]/);
          let insert_sql;
  
          if (typeof ary[2] !== 'undefined' &amp;&amp; typeof  ary[3] !== 'undefined') {
              insert_sql =
                  'INSERT INTO proxies (host, port, username, password) ' +
                  'VALUES ("' + ary[0] + '", "' + ary[1] + '", "' + ary[2] + '", "' + ary[3] + '")';
          } else {
              insert_sql =
                  'INSERT INTO proxies (host, port) ' +
                  'VALUES ("' + ary[0] + '", "' + ary[1] + '")';
          }
  
          connection.query(insert_sql, function (error, results, fields) {
              if (error) {
                  console.log('error: ' + error);
              } else {
                  console.log('success: ' + insert_sql);
              }
          });
  
      });
  
  connection.end();
  </code></pre>