// `Close` syncs the file to disk and then closes the file.
9562
func (a syncOnWrite) Close() error {
    err := a.file.Sync()
    if err != nil {
        return err
    }
    return a.file.Close()
}
1192236
func (w *BatchedFileWriter) Close() error {
	if w.compressOnClose {
		return w.compressAndCloseLog()
	}

	return w.file.Close()
}
999615
func (f *fileSystem) Close() error {
	if f.temporary {
		return os.RemoveAll(f.root)
	}
	return nil
}
144920
func (bt *Translator) Close() error {
	err := bt.Db.Sync()
	if err != nil {
		return errors.Wrap(err, "syncing db")
	}
	return bt.Db.Close()
}
1154041
func (f *File) Close() error {
	f.buf = nil
	f.dirIndex = 0

	return nil
}
289094
func (fs *FileStore) Close() error {
	fs.Lock()
	if fs.closed {
		fs.Unlock()
		return nil
	}
	fs.closed = true

	err := fs.genericStore.close()

	fm := fs.fm
	lockFile := fs.lockFile
	fs.Unlock()

	if fm != nil {
		if fmerr := fm.close(); fmerr != nil && err == nil {
			err = fmerr
		}
	}
	if lockFile != nil {
		err = util.CloseFile(err, lockFile)
	}
	return err
}
444544
func (f *FileReadSeeker) Close() error {
	if err := f.file.Close(); err != nil {
		return err
	}

	return os.Remove(f.file.Name())
}
528961
func (s *Simple) Close() error {
	if s.config.GCPeriodicity > 0 {
		close(s.halt)
		return <-s.closeError
	}
	return nil
}
701301
func (m *FileMutex) Close() error {
	var ol syscall.Overlapped
	if err := unlockFileEx(m.fd, 0, 1, 0, &ol); err != nil {
		return err
	}
	return syscall.Close(m.fd)
}
398659
func (fs FileSet) Close() error {
	var err error
	for _, f := range fs.files {
		if e := f.Close(); e != nil && err == nil {
			err = e
		}
	}
	return err
}
444150
func (l *LogFile) Close() error {
	l.writer.Flush()
	l.writer.Close()
	return l.file.Close()
}
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
}
814026
func (r *RLockedFile) Close() (err error) {
	r.mutex.Lock()
	defer r.mutex.Unlock()

	if r.refs == 0 {
		return os.ErrInvalid
	}

	r.refs--
	if r.refs == 0 {
		err = r.File.Close()
	}

	return err
}
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
}
440672
func (f *FileStorage) Close() error {
	f.subscription.Close()
	return f.file.Close()
}
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
}
346302
func (s *storage) Close() error {
	s.mu.Lock()
	defer s.mu.Unlock()
	if s.closed {
		return nil
	}
	var closeErr error
	s.closed = true
	if err := s.index.Close(); err != nil {
		log.Println("diskpacked: closing index:", err)
	}
	for _, f := range s.fds {
		err := f.Close()
		openFdsVar.Add(s.root, -1)
		if err != nil {
			closeErr = err
		}
	}
	if err := s.closePack(); err != nil && closeErr == nil {
		closeErr = err
	}
	return closeErr
}