Handle errors in wrapped streams

Fixes #67.