check for ClosedHandle in read/write operations on DuplexHandles (#4808)