[`PipeWriter.CloseWithError`](http://golang.org/pkg/io/#PipeWriter.CloseWithError) could be interesting here.