Handle broken pipes in a more elegant manner