Writable file stream with memory buffer and reopen feature