public function close() {
        if (!isset($this->za)) {
            return false;
        }

        if ($this->emptyziphack) {
            @$this->za->close();
            $this->za = null;
            $this->mode = null;
            $this->namelookup = null;
            $this->modified = false;
            @unlink($this->emptyziphack);
            $this->emptyziphack = false;
            return true;

        } else if ($this->za->numFiles == 0) {
            // PHP can not create empty archives, so let's fake it.
            @$this->za->close();
            $this->za = null;
            $this->mode = null;
            $this->namelookup = null;
            $this->modified = false;
            // If the existing archive is already empty, we didn't change it.  Don't bother completing a save.
            // This is important when we are inspecting archives that we might not have write permission to.
            if (@filesize($this->archivepathname) == 22 &&
                    @file_get_contents($this->archivepathname) === base64_decode(self::$emptyzipcontent)) {
                return true;
            }
            @unlink($this->archivepathname);
            $data = base64_decode(self::$emptyzipcontent);
            if (!file_put_contents($this->archivepathname, $data)) {
                return false;
            }
            return true;
        }

        $res = $this->za->close();
        $this->za = null;
        $this->mode = null;
        $this->namelookup = null;

        if ($this->modified) {
            $this->fix_utf8_flags();
            $this->modified = false;
        }

        return $res;
    }