lib/standard/streams: Added simple error management for streams