Correctly handle close and EPOLLRDHUP