Fix #4296 Catch errors from broken pipes