Run the test case -[ModesTests testModes_NestedWrites] with the Address Sanitizer turned on, and the -[UZKArchive closeFile:inMode:] method gets called for the inner write, causing the outer write to use a deallocated pointer when it attempts to close the archive. Instead, don't close the file when the inner write fails to open the file.