title: Express server doesn't close
body: <p>I'm creating an Express server with reloadable endpoints.<br />
  To make this possible I created an endpoint for such a purpose.</p>
  <p>But when I call <code>server.close()</code> on the Express's HTTP server it still continues listening, while the <code>server.listening</code> says otherwise, it still is.</p>
  <p>Here is a simplified version of my script (<em>Not working fully, but you get the gist</em>):</p>
  <pre><code>class simpleServer {
      constructor() {
           let express = require('express');
           this.app = express();
           this.app.get('/reload', this.reload);
           this.server = this.app.listen(3000);
      }
  
      reload(req, res) {
           console.log('Closing server');             
  
           this.server.close(function() {
               console.log('Closed server');
           });
           
           // Re-init &amp; stuff
  
           res.json({
               message: 'Reloaded'
           });
      }
  }
  
  let server = new simpleServer();
  </code></pre>
  <p>When I call the endpoint, the server will output 'Closing server', but the 'Closed server' takes a long time to be called (5 minutes). And when I reload the page, it still works, while the <code>server.listening</code> is equal to <code>false</code>.</p>
  <p>I'm using Node.js version <strong>6.0.0</strong> with Express version <strong>4.14.0</strong>.</p>
  <hr />
  <p>Some updates:</p>
  <p>I fixed the issue by calling <code>req.destroy()</code> after sending the response, does this have any side-effects tho?</p>
  <p>A cleaner fix would be keeping a record of current connections and closing those in the reload function instead of closing them instantly. This will probably be less heavy if you have a higher load.</p>