Fix a few bugs introduced by the move to zip_archive.

- mmap failures because the output file was opened with
  O_WRONLY instead of O_RDWR

- In two instances, we were passing the wrong handle
  to CloseArchive(ZipArchiveHandle). The issue is code
  like this:

  ZipArchiveHandle h;
  OpenArchive(&h);
  CloseArchive(&h);

  This compiles, but isn't correct. ZipArchiveHandle is
  a typedef for (void *) and the compiler won't complain
  because void** is also void*. Some of this code was written
  before the API was changed from CloseArchive(ZipArchiveHandle&)
  to CloseArchie(ZipArchiveHandle) but continued to compile
  even after the API change. I'll change the API in the follow up
  to catch errors like this at compile time.

bug: 12173498
bug: 12176258
bug: 12178641

Change-Id: I71ac36654311f582b5ab633e1ed0d13e00053c84
2 files changed