title: Node-SerialPort Issue w/ Multiple Writes
body: <p>When I pass an array with 1 element everything works great, when I pass one with two (max for our use case) I get the following error:</p>
  
  <blockquote>
    <p>There's no write queue for that file descriptor (after write)!</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>exports.triggerPhysical = function(state, alerts) {
  
  console.dir("IN PHYSICAL");
  console.dir(alerts);
  
    SerialPort.list(function(err, ports) {
  
        var port = {};
  
        for(var i = 0; i &lt; ports.length; i++) {
          try {
            if(typeof ports[i].manufacturer != 'undefined' &amp;&amp; ports[i].manufacturer.includes("Numato")) {
              port = ports[i];
            }
          } catch(err) {
            console.dir(err);
          }
        }
  
        var numato = new SerialPort(port.comName, {baudrate : 19200}, function(err) {
          if(err) {
            return console.dir(err);
          }
  
          console.dir('calling write');       
  
          for(var j = 0; j &lt; alerts.length; j++) {
              numato.write('relay ' + state + ' ' + alerts[j].index + '\r', function(err) {
                if(err) {
                  console.dir('error writing');
                  console.dir(err);
                }
                console.dir('serial message written');              
            });           
          }
  
        numato.close();
  
        return true;
  
      });
    });
  }
  </code></pre>
  
  <p>First write works great, second one fails. I am guessing there is an obvious solution but I am not finding it. Any insight would be much appreciated.</p>