Close the session completely. We also remove all locks we may have obtained that aren't expired.

@return bool true on success.  false on unable to unlock sessions.
508010
public function handler_close() {
        try {
            foreach ($this->locks as $id => $expirytime) {
                if ($expirytime > $this->time()) {
                    $this->unlock_session($id);
                }
                unset($this->locks[$id]);
            }
        } catch (RedisException $e) {
            error_log('Failed talking to redis: '.$e->getMessage());
            return false;
        }

        return true;
    }
471912
public function close(){
        if($this->status() !== self::ACTIVE){
            throw Exception\SessionException::notStarted();
        }

        session_commit();
        
        $this->finishedData = $_SESSION;
    }
551555
public static function close()
    {
        Base::checkOpen();
        if (Base::driver() == 'file') {
            if (session_status() == PHP_SESSION_ACTIVE) {
                session_write_close();
            }
            return true;
        }
        return Base::getSessionObject()->close();
    }
34987
public function Destroy ()
	{
		
		// If no session has been started, bail here before session_destroy() errors
		
		$sessionID	= session_id ();
		
		if (empty ($sessionID))
		{
			return FALSE;
		}

		// Cookie Destruction
		
		$cookie	= session_get_cookie_params ();
		
		if ((empty ($cookie['domain'])) && (empty ($cookie['secure'])))
		{
			setcookie (session_name (), '', time () -99999, $cookie['path']);
		}
		elseif (empty ($cookie['secure']))
		{
			setcookie (session_name (), '', time () -99999, $cookie['path'], $cookie['domain']);
		}
		else
		{
			setcookie (session_name (), '', time () -99999, $cookie['path'], $cookie['domain'], $cookie['secure']);
		}
		
		// Session Destruction
		
		$_SESSION	= array ();
		
		return session_destroy ();
		
	}
792714
public function unlock()
    {
        $this->_validate();
        $_SESSION[$this->secretStorage]['locks'][$this->_namespaceName] = false;
        return true;
    }
421098
public static function Close () {
		if (!static::GetStarted()) return;
		register_shutdown_function(function () {
			foreach (static::$instances as & $instance)
				if (count((array) $_SESSION[$instance->__name]) === 0)
					// if there is nothing in namespace - destroy it. It's useless.
					$instance->Destroy();
			$metaKey = static::SESSION_METADATA_KEY;
			$_SESSION[$metaKey] = serialize(static::$meta);
			@session_write_close();
		});
	}
1272545
public function close()
    {
        if (false === $this->openned) {
            return false;
        }
        $this->pclzip = $this->filename = null;
        $this->openned = false;
        if (file_exists(self::TMP_DIR)) {
            $this->_rrmdir(self::TMP_DIR);
            rmdir(self::TMP_DIR);
        }
        return true;
    }
64221
public function unlock(): bool
    {
        $result = false;

        if ($this->locker->releaseLock()) {
            $result = true;
        }

        return $result;
    }
801750
public function kill_all_sessions() {
        global $DB;
        if (!$this->servers) {
            return;
        }

        // Go through the list of all servers because
        // we do not know where the session handler put the
        // data.

        $memcacheds = array();
        foreach ($this->servers as $server) {
            list($host, $port) = $server;
            $memcached = new \Memcached();
            $memcached->addServer($host, $port);
            $memcacheds[] = $memcached;
        }

        // Note: this can be significantly improved by fetching keys from memcached,
        //       but we need to make sure we are not deleting somebody else's sessions.

        $rs = $DB->get_recordset('sessions', array(), 'id DESC', 'id, sid');
        foreach ($rs as $record) {
            foreach ($memcacheds as $memcached) {
                $memcached->delete($this->prefix . $record->sid);
            }
        }
        $rs->close();

        foreach ($memcacheds as $memcached) {
            $memcached->quit();
        }
    }
525472
function _close()
	{
		if ($this->_connectionID) $this->_connectionID->Close();
		$this->_connectionID = false;
		return true;
	}
1003225
public function close()
    {
        if (!$this->_started) {
            return true;
        }

        if (!session_write_close()) {
            throw new RuntimeException('Could not close the session');
        }

        $this->_started = false;

        return true;
    }
433943
public function writeClose()
    {
        if (!$this->id) {
            return false;
        }
        // allow session to be closed, even if write fails. Otherwise destructor will try again.
        $wasSaved = $this->saveData();
        $this->handler->close();
        $this->id = '';
        $this->data = null;
        return $wasSaved;
    }
951881
public function handler_close() {
        if ($this->recordid) {
            try {
                $this->database->release_session_lock($this->recordid);
            } catch (\Exception $ex) {
                // Ignore any problems.
            }
        }
        $this->recordid = null;
        $this->lasthash = null;
        return true;
    }
410034
public function close() {
        $this->gc(ini_get('session.gc_maxlifetime'));
        $this->handler->close();
        $this->handler = null;
        return true;
    }
554813
public function logout()
    {
        $this->_session->delete('auth');
        $this->_session->delete('expire');
        $this->_session->delete('_token');
        $this->_session->delete('_token_meta');

        return $this->check() ? false : true;
    }
1124131
public static function sessionWriteClose()
    {
        Base::getLog()->debug(__METHOD__ . ' call session write close');
        if (PHP_SAPI != 'cli')
        {
            session_write_close();
            return true;
        }
        if ( ! empty($_SESSION))
        {
            $sessionStr = json_encode($_SESSION);
            if ($sessionStr)
            {
                $sessionID = self::getSessionID();
                $fileName = self::getSessionFile($sessionID);
                Base::getLog()->debug(__METHOD__ . ' save session data to file', [
                    'file' => $fileName,
                ]);
                return file_put_contents($fileName, $sessionStr);
            }
        }
        else
        {
            Base::getLog()->notice(__METHOD__ . ' session date is empty');
        }
        return empty($_SESSION);
    }
610296
public function close()
    {
        if (version_compare(PHP_VERSION, '5.4', '>')) {
            if (session_status() == PHP_SESSION_ACTIVE) {
                session_write_close();
            }
        } else {
            @session_write_close();
        }
        $this->is_opened = false;
        return $this;
    }