Ensure handle still open before emitting listening, fixes #7834

Fixes #7834.

```js
net.createServer()
  .on('listening', console.log.bind(console, 'listening'))
  .listen()
  .close();
```

/cc @indutny