prepare for streaming support
fix stream closing when there are pending readers
support for streaming from disk