Fix a bug where NioEventLoop.processSelectedKeys() enters an infinite loop when too many connections are closed at once

- Fixes #1171