#52 Fix termination on EPIPE in some cases