pipe: be robust in face of closed fds