Better detection of closed connections