readline: fix memory leak related EventEmitter

The `close` event of readline.Interface should remove `end`
listeners for input and output, then fix this.

This issue also might be reproduced at:
https://github.com/npm/npm/issues/5203

And I also added a test case for coverage of this memory leak detects.