Close this file and commit it to its permanent location.

        @return: a Deferred which fires when the file has been moved (and
        backed up to tertiary storage, if necessary).
15066
def close(self):
        
        now = time.time()
        try:
            file.close(self)
            _mkdirIfNotExists(self._destpath.dirname())
            self.finalpath = self._destpath
            os.rename(self.name, self.finalpath.path)
            os.utime(self.finalpath.path, (now, now))
        except:
            return defer.fail()
        return defer.succeed(self.finalpath)
765778
def commit(self, **params):
        
        log = self._getparam('log', self._discard, **params)

        #  Find all the modules that no longer need watching
        #
        removed = 0
        added = 0
        for path in list(self.paths_open):
            if path not in self.paths:
                fd = self.paths_open[path]
                if self._mode == WF_KQUEUE:
                    #  kevent automatically deletes the event when the fd is closed
                    try:
                        os.close(fd)
                    except Exception as e:
                        log.warning("close failed on watched file %r -- %s", path, e)
                elif self._mode == WF_INOTIFYX:
                    try:
                        pynotifyx.rm_watch(self._inx_fd, fd)
                    except Exception as e:
                        log.warning("remove failed on watched file %r -- %s", path, e)
                    if path in self._inx_inode:
                        del self._inx_inode[path]
                elif self._mode == WF_POLLING:
                    if fd in self._poll_stat:
                        del self._poll_stat[fd]
                    else:
                        log.warning("fd watched path %r missing from _poll_stat map", path)
                    try:
                        os.close(fd)
                    except Exception as e:
                        log.warning("close failed on watched file %r -- %s", path, e)
                if fd in self.fds_open:
                    del self.fds_open[fd]
                else:
                    log.warning("fd watched path %r missing from fd map", path)
                del self.paths_open[path]
                log.debug("Removed watch for path %r", path)
                removed += 1

        #  Find all the paths that are new and should be watched
        #
        fdlist = []
        failed = []
        last_exc = None
        log.debug("%d watched path%s", len(self.paths), ses(len(self.paths)))
        for path in list(self.paths):
            if path not in self.paths_open:
                try:
                    if not self._add_file(path, **params):
                        continue
                except Exception as e:
                    last_exc = e
                    failed.append(path)
                    continue
                fdlist.append(self.paths_open[path])

                if path in self.paths_pending:
                    log.debug("pending path %r has now appeared", path)
                    del self.paths_pending[path]
                    self._trigger(self.paths_open[path], **params)

                added += 1
                log.debug("Added watch for path %r with ident %d", path, self.paths_open[path])
        if failed:
            self._clean_failed_fds(fdlist)
            raise Exception("Failed to set watch on %s -- %s" % (str(failed), str(last_exc)))
        log.debug("%d added, %d removed", added, removed)
1231406
def close(self):
        """"""
        if not self.active:
            return

        self.active = False
        if self._file:
            self._file.close()
            self._sincedb_update_position(force_update=True)

        if self._current_event:
            event = '\n'.join(self._current_event)
            self._current_event.clear()
            self._callback_wrapper([event])
880307
def close(self):
        
        if self.file:
            self.file.close()
            self.file = None

        # If temp_file is a folder, we do not remove it because we may
        # still need it after the unpickler is disposed
        if self.tmp_file and _os.path.isfile(self.tmp_file):
            _os.remove(self.tmp_file)
            self.tmp_file = None
277795
def close(self):
        '''
        

        '''

        if self.compressed_file is None:
            with self.path.open('rb+') as f:
                f.seek(0, 2)
                eof = f.tell()
                self._update_offset_value(f, self.gdr_head+36, 8, eof)
                if self.checksum:
                    f.write(self._md5_compute(f))
            return
# %%
        with self.path.open('rb+') as f:
            f.seek(0, 2)
            eof = f.tell()
            self._update_offset_value(f, self.gdr_head+36, 8, eof)

            with self.compressed_file.open('wb+') as g:
                g.write(bytearray.fromhex(CDF.V3magicNUMBER_1))
                g.write(bytearray.fromhex(CDF.V3magicNUMBER_2c))
                self._write_ccr(f, g, self.compression)

                if self.checksum:
                    g.seek(0, 2)
                    g.write(self._md5_compute(g))

        self.path.unlink()  # NOTE: for Windows this is necessary
        self.compressed_file.rename(self.path)
341268
def close(self):
        
        self.active = False
        self.end = utcnow()
        self._model.save()
96884
def close(self):
        
        if self._file:
            if not(self._file.closed):
                self._file.close()
        self.closed = True
457886
def _Close(self):
    
    self._vshadow_volume.close()
    self._vshadow_volume = None

    self._file_object.close()
    self._file_object = None
312522
def close(self) -> None:
        
        if self.underlying_stream:
            if self.using_stdout:
                sys.stdout = self.underlying_stream
            else:
                sys.stderr = self.underlying_stream
            self.underlying_stream = None
        if self.file:
            # Do NOT close the file; we don't own it.
            self.file = None
            log.debug("Finished copying {} to {}",
                      self.output_description, self.filename)
1011878
def close(self):
        """"""
        if not self.closed:
            # be sure to flush data to disk before closing the file
            self.flush()
            err = _snd.sf_close(self._file)
            self._file = None
            _error_check(err)
427297
def _Close(self):
    
    if not self._file_object_set_in_init:
      try:
        # TODO: fix close being called for the same object multiple times.
        self._file_object.close()
      except IOError:
        pass
      self._file_object = None
37309
def close(self):
        
        if self._closed:
            return defer.succeed(None)

        def ok(_):
            self._closed = True
        return self.__flush().addCallback(ok)
959086
def on_close(self, filename):
        """"""
        shutil.move(filename, self.destination_folder)
        path, fn = os.path.split(filename)
        return os.path.join(self.destination_folder, fn)
240299
def close(self):
        
        try:
            self.p.stdin.write(bytes("X\n","utf-8"))
            self.p.stdin.flush()
        except IOError:
            self.report("could not send exit command")
        self.p.wait() # wait until the process is closed
        try:
            os.remove(self.tmpfile) # clean up the temporary file
        except FileNotFoundError:
            pass
1272401
def _Close(self):
    
    self._fvde_volume.close()
    self._fvde_volume = None

    self._file_object.close()
    self._file_object = None
846221
def close(self):
        
        if self.file is None:
            return

        # Close the pickle file.
        self.file.close()
        self.file = None

        for f in self.mark_for_delete:
            error = [False]

            def register_error(*args):
                error[0] = True

            _shutil.rmtree(f, onerror = register_error)

            if error[0]:
                _atexit.register(_shutil.rmtree, f, ignore_errors=True)
480578
def download!
      return download if file.nil?

      file.close
      file.unlink
      self.file = nil
      download
    end