do not close user-provided streams, only those created and opened by the
library internally, fixes #5