//Close - allows us to clean up the tmp file (delete, close)
8370
func (s *TempFile) Close() {
	lo.G.Debug("removing tmpfile: ", s.FileRef.Name())
	s.FileRef.Close()

	if e := os.Remove(s.FileRef.Name()); e != nil {
		lo.G.Errorf("removing tmpfile: %s failed with %s", s.FileRef.Name(), e)
	}
}
923976
func (tm *taskManager) Close() error {
	tm.shutdownOnce.Do(func() {
		close(tm.shutdown)
	})

	<-tm.closed

	return nil
}
884603
func (f *followDatastoreFile) Close() error {
	f.o.Do(func() { close(f.c) })
	return nil
}
1355883
func (b BufferedFileWriter) Close() error {
	if err := b.Flush(); err != nil {
		return err
	}
	return b.file.Close()
}
586987
func (d deleteOnClose) Close(ctx context.Context, corrupt bool) (err error) {
	name := d.File.Name()
	defer func() {
		if rmErr := os.Remove(name); err == nil && rmErr != nil && !os.IsNotExist(rmErr) {
			err = rmErr
		}
	}()
	return d.File.Close()
}
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
}
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)
}
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
}
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
}
9562
func (a syncOnWrite) Close() error {
    err := a.file.Sync()
    if err != nil {
        return err
    }
    return a.file.Close()
}
127509
func (f *LockPIDFile) Close() (err error) {
	if f.file != nil {
		if e1 := f.file.Close(); e1 != nil {
			f.log.Warningf("Error closing pid file: %s\n", e1)
		}
		f.log.Debugf("Cleaning up pidfile %s", f.name)
		if err = os.Remove(f.name); err != nil {
			f.log.Warningf("Error removing pidfile: %s\n", err)
		}
	}
	return
}
610788
func (t *TarFile) Close() error {
	err := t.Writer.Close()
	if err != nil {
		return err
	}

	if t.Compressed {
		err = t.GzWriter.Close()
		if err != nil {
			return err
		}
	}

	// If the out writer supports io.Closer, Close it.
	if c, ok := t.out.(io.Closer); ok {
		c.Close()
	}
	return err
}
1125406
func (file *File) Close() error {
	// Should we cancel all pending requests for the File
	return file.Fid.Clnt.Clunk(file.Fid)
}
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
}
1284656
func (f *LogFile) Close() error {
	// Wait until the file has no more references.
	f.wg.Wait()

	if f.w != nil {
		f.w.Flush()
		f.w = nil
	}

	if f.file != nil {
		f.file.Close()
		f.file = nil
	}

	if f.data != nil {
		mmap.Unmap(f.data)
	}

	f.mms = make(logMeasurements)
	return nil
}
872916
func (t *File) Close() error {
	if t.fh == nil {
		return nil
	}
	return t.fh.Close()
}
696211
func (m *multipartBody) Close() error {
	if m.r != nil {
		m.r.Close()
	}
	return nil
}