Fix infinite loop when using extents.
Clearing |buffer_| still actually makes sense because MemoryFile::Close()
is called twice: once explicitly from bspatch to check if Close()
succeeded, once from destructor to ensure that everything is closed. And
if we don't clear |buffer_|, on the second Close(), it will try to write
|buffer_| to |file_| again, and if |file_| is an ExtentsFile, it will
simply return true and set |bytes_written| to 0 on Write() because all
the extents are already written, now WriteAll() became an infinite
Although returning false if written is 0 in WriteAll() will fix this, but
I think we should not write the same buffer again in the first place.
Test: call bspatch with extents
2 files changed