pg_dump: Write failed: Connection reset by peer
This looks like the error is coming from your ssh session, not pg_dump.  Use 'screen' or 'tmux' so you can resume the session after ssh failure.

Perhaps pg_dump is still running, or completed normally, even after it's controlling session went away.