Whether writing to the socket fails is implementation defined, see https://stackoverflow.com/a/4022160/2373138.
Shutting down the read side of the socket generally doesn't have any effect on the peer, seems like this is due to the local host implementation on Linux.
Fixes#40. Streams on MacOS (and possibly FreeBSD) that are closed by the remote still allow writing, returning a non-zero from fwrite(). EOF then is false, since data was written to the buffer. EOF needed to be checked before calling fwrite().