On Unix, the exceptions correspond to EPIPE errors, and on Windows to:
- error: ![Errno 10053] An established connection was aborted by the software in your host machine
- error: ![Errno 10054] An existing connection was forcibly closed by the remote host
Closes #8582.