Fail on failed write (e.g. pipe).

Hi,

A simple change here, I hope you can accept it.

`shineenc` should fail when a write fails.  Otherwise, it's impossible to use it in a pipe.

Thanks!