Implement a callback when a polling socket is closed