io: fix duplex read on last bytes of closed pipe.