Level 88
This is a thing that's really hard to debug without being on your computer! However you can for example set some timeouts in your SSH config to keep the session alive: https://askubuntu.com/questions/127369/how-to-prevent-write-failed-broken-pipe-on-ssh-connection
If you for example use zsh you might have added some custom scripts, they can also make this Broken pipe happen. So try to go vanilla first and try again. If you still get problems we probably need more info ;)