// Close closes the underlying file
335758
func (c *Client) Close() {
	if c.file != nil && c.file != os.Stdout {
		c.file.Close()
	}
}
700404
func (w *DataFileWriter) Close() error {
	err := w.Flush() // flush anything remaining
	if err == nil {
		// Do an empty flush to signal end of data file format
		err = w.actuallyFlush()

		if err == nil {
			// Clean up references.
			w.output, w.outputEnc, w.datumWriter = nil, nil, nil
			w.blockBuf, w.blockEnc = nil, nil
		}
	}
	return err
}
121549
func (l *SingleFileStore) close() error {
	if l.file == nil {
		return nil
	}
	err := l.file.Close()
	l.file = nil
	return err
}
617747
func (f *IndexFile) Close() error {
	// Wait until all references are released.
	f.wg.Wait()

	f.sfile = nil
	f.tblks = nil
	f.mblk = MeasurementBlock{}
	return mmap.Unmap(f.data)
}
453242
func (file *ObjectOpenFile) Close() (err error) {
	// Close the body at the end
	defer checkClose(file.resp.Body, &err)

	// If not end of file or seeked then can't check anything
	if !file.eof || file.seeked {
		return
	}

	// Check the MD5 sum if requested
	if file.checkHash {
		receivedMd5 := strings.ToLower(file.resp.Header.Get("Etag"))
		calculatedMd5 := fmt.Sprintf("%x", file.hash.Sum(nil))
		if receivedMd5 != calculatedMd5 {
			err = ObjectCorrupted
			return
		}
	}

	// Check to see we read the correct number of bytes
	if file.lengthOk && file.length != file.bytes {
		err = ObjectCorrupted
		return
	}
	return
}
1322032
func (l *SingleFileStore) Close() error {
	l.mu.Lock()
	defer l.mu.Unlock()
	return l.close()
}
1072282
func (f *Logfile) Close() error {
	f.Lock()
	defer f.Unlock()

	return f.closeLog()
}
1302824
func (e *env) Close() error {
	e.l.Lock()
	defer e.l.Unlock()
	e.shouldClose = true
	e.e.Sync(1)
	e.e.Close()
	return nil
}
409818
func (f *File) Close() (err error) {
	if C.sf_close(f.s) != 0 {
		err = errors.New(C.GoString(C.sf_strerror(f.s)))
	}
	if f.closeFd {
		nf := os.NewFile(f.fd, "")
		err = nf.Close()
	}
	runtime.SetFinalizer(f, nil)
	return
}
1145815
func (af *AutoFile) Close() error {
	af.closeTicker.Stop()
	close(af.closeTickerStopc)
	if af.hupc != nil {
		close(af.hupc)
	}
	return af.closeFile()
}
1154041
func (f *File) Close() error {
	f.buf = nil
	f.dirIndex = 0

	return nil
}
60762
func (w *File) Close() error {
	if w.tempFile != nil {
		if err := cleanupFile(w.tempFile); err != nil {
			return err
		}
		w.tempFile = nil
	}

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

	return nil
}
570273
func (f *File) Close() error {
	if f.appendedF != nil {
		if f.appendedFileReader == nil {
			return errors.New("already closed")
		}
		f.appendedFileReader = nil
		return nil
	}
	if f.virtualF != nil {
		return f.virtualF.close()
	}
	if f.virtualD != nil {
		return f.virtualD.close()
	}
	return f.realF.Close()
}
835077
func (f *DatastoreFile) Close() error {
	var err error

	if f.body != nil {
		err = f.body.Close()
		f.body = nil
	}

	f.buf = nil

	return err
}
211300
func (s *Storage) Close() {
	s.run(func() error {
		s.closed = true
		return nil
	})
}
1162787
func (f *IndexFile) Close() error {
	// Close the resource and wait for any references.
	f.res.Close()

	if f.sfileref != nil {
		f.sfileref.Release()
		f.sfileref = nil
	}

	f.sfile = nil
	f.tblks = nil
	f.mblk = MeasurementBlock{}
	return mmap.Unmap(f.data)
}
248746
func (s *TranslateFile) Close() (err error) {
	s.once.Do(func() {
		close(s.closing)

		if s.file != nil {
			if e := s.file.Close(); e != nil && err == nil {
				err = e
			}
		}
		if s.data != nil {
			if e := syscall.Munmap(s.data); e != nil && err == nil {
				err = e
			}
		}
	})
	s.wg.Wait()
	return err
}