// Close closes the zip archive(s) opened by Create and Open.
497859
func (z *Zip) Close() error {
	if z.zr != nil {
		z.zr = nil
	}
	if z.zw != nil {
		zw := z.zw
		z.zw = nil
		return zw.Close()
	}
	return nil
}
753940
func (fl *File) Close() error {
	if fl.fo != nil {
		if err := fl.fo.Close(); err != nil {
			return err
		}
		fl.fo = nil
	}

	if fl.fe != nil {
		return fl.fe.Close()
	}

	return nil
}
1221337
func (c *Cache) Close() {
	if !atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
		// Already closed
		return
	}
	logger.Debugf("%s - Closing cache", c.name)
	c.DeleteAll()
}
560487
func (c *ZkConn) Close() error {
	c.mu.Lock()
	defer c.mu.Unlock()
	if c.conn != nil {
		c.conn.Close()
	}
	return nil
}
1209426
func (z *Writer) Close() error {
	if !z.wroteHeader {
		z.err = z.writeHeader()
	}
	if z.err != nil {
		return z.err
	}
	z.err = z.compressor.Close()
	if z.err != nil {
		return z.err
	}
	checksum := z.digest.Sum32()
	// ZLIB (RFC 1950) is big-endian, unlike GZIP (RFC 1952).
	z.scratch[0] = uint8(checksum >> 24)
	z.scratch[1] = uint8(checksum >> 16)
	z.scratch[2] = uint8(checksum >> 8)
	z.scratch[3] = uint8(checksum >> 0)
	_, z.err = z.w.Write(z.scratch[0:4])
	return z.err
}
696211
func (m *multipartBody) Close() error {
	if m.r != nil {
		m.r.Close()
	}
	return nil
}
69100
func (a *Archiver) Close() error {
	// This is done so asynchronously calling push() won't crash.

	a.closeLock.Lock()
	ok := false
	if a.stage1 != nil {
		close(a.stage1)
		a.stage1 = nil
		ok = true
	}
	a.closeLock.Unlock()

	if !ok {
		return errors.New("was already closed")
	}
	a.wg.Wait()
	_ = a.progress.Close()
	tracer.Instant(a, "done", tracer.Global, nil)
	err := a.ctx.Err()
	// Documentation says that not calling cancel() could cause a leak, so call
	// it, but not before taking the context's error, if any.
	a.cancel()
	return err
}
666818
func (f *fileCloser) Close() error {
	err := f.f.Close()
	if err != nil {
		return fmt.Errorf(
			"Could not close file %v: %v",
			f.path,
			err,
		)
	}
	return nil
}
1154041
func (f *File) Close() error {
	f.buf = nil
	f.dirIndex = 0

	return nil
}
723902
func (w *Writer) Close() error {
	if err := w.zlib.Close(); err != nil {
		return err
	}

	w.closed = true
	return nil
}
884603
func (f *followDatastoreFile) Close() error {
	f.o.Do(func() { close(f.c) })
	return nil
}
984071
func (hs *httpSink) Close() error {
	hs.mu.Lock()
	defer hs.mu.Unlock()

	if hs.closed {
		return fmt.Errorf("httpsink: already closed")
	}

	hs.closed = true
	return nil
}
1343263
func (file *File) Close() (err error) {
	defer func() {
		if err != nil {
			os.Remove(file.tmpfile.Name())
			file.aborted = true
		}
	}()

	if file.closed {
		err = errors.New("close on closed file")
		return
	}
	if file.aborted {
		err = errors.New("close on aborted file")
		return
	}

	if err = file.tmpfile.Close(); err != nil {
		return
	}

	err = os.Rename(file.tmpfile.Name(), file.name)

	file.closed = true
	return
}
1192236
func (w *BatchedFileWriter) Close() error {
	if w.compressOnClose {
		return w.compressAndCloseLog()
	}

	return w.file.Close()
}
1211453
func (w *tarWriter) Close(remove bool) error {
	if w.writer != nil {
		if err := w.writer.Close(); err != nil {
			return err
		}
	}

	if w.compressWriter != nil {
		if err := w.compressWriter.Close(); err != nil {
			return err
		}
	}

	if err := w.file.Close(); err != nil {
		return err
	}

	if remove {
		return os.Remove(w.fileName)
	}

	return nil
}
229048
func (c *compressionResponseWriter) Close() error {
	if c.compressorClosed() {
		return errors.New("Compressing error: tried to close already closed compressor")
	}

	c.compressor.Close()
	c.compressor = nil
	return nil
}
619236
func (a Archive) Close() error {
	if err := a.tw.Close(); err != nil {
		return err
	}
	return a.gw.Close()
}