Correctly handle EAGAIN when writing to PipeIOStreams

BaseIOStream._handle_write needs to catch IOError and OSError as
well as socket.error in order to handle EAGAIN when writing to a
PipeIOStream (which doesn't appear to raise socket.error when the
buffer is full).

This also provides consistency with the exceptions caught by
BaseIOStream._read_to_buffer.