def METHOD_NAME(self):
    if self.ttylogEnabled:
        ttylog.ttylog_close(self.ttylogFile, time.time())
        shasum = ttylog.ttylog_inputhash(self.ttylogFile)
        shasumfile = os.path.join(self.ttylogPath, shasum)
        if os.path.exists(shasumfile):
            duplicate = True
            os.remove(self.ttylogFile)
        else:
            duplicate = False
            os.rename(self.ttylogFile, shasumfile)
            umask = os.umask(0)
            os.umask(umask)
            os.chmod(shasumfile, 0o666 & ~umask)
        log.msg(
            eventid="cowrie.log.closed",
            format="Closing TTY Log: %(ttylog)s after %(duration)d seconds",
            ttylog=shasumfile,
            size=self.ttylogSize,
            shasum=shasum,
            duplicate=duplicate,
            duration=time.time() - self.startTime,
        )