Allow Tempfile as IO for OutputStream::write_buffer

Resolves #146