Write data and close the session. (This is called automatically by the destructor,
but for the sake of proper serialization, you should call it explicitly)

@return bool success
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;
    }
1101040
protected function finalizeWrite(): void
    {
        $res = $this->getResource();
        if (is_resource($res)) {
            @fread($res, 2048);
        }
        $this->closeSocket();
    }
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;
    }
1306305
public function closeSession()
    {
        if (isset(\Yii::$app) && \Yii::$app->has('session', true)) {
            \Yii::$app->session->close();
        }
    }
258031
public function setSaveHandler()
    {
        session_module_name( 'user' );
        session_set_save_handler(
            array( $this, 'open' ),
            array( $this, 'close' ),
            array( $this, 'read' ),
            array( $this, 'write' ),
            array( $this, 'destroy' ),
            array( $this, 'gc' )
            );
        return true;
    }
133929
protected function close()
    {
        if (is_resource($this->stream)) {
            $this->flush();
            fclose($this->stream);
        }
        $this->stream = false;
    }
721050
public function write()
    {
        if (!count($this->sndQueue)) {
            return false;
        }

        $line   = array_shift($this->sndQueue);
        $logger = \Plop\Plop::getInstance();

        // Make sure we send the whole line,
        // with a trailing CR LF sequence.
        $eol    = $this->eol[count($this->eol) - 1];
        $line  .= $eol;
        $len    = strlen($line);
        for ($written = 0; $written < $len; $written += $fwrite) {
            $fwrite = @fwrite($this->socket, substr($line, $written));
            if ($fwrite === false) {
                return false;
            }
        }
        $line = substr($line, 0, -strlen($eol));
        $logger->debug(
            '%(line)s',
            array('line' => addcslashes($line, "\000..\037"))
        );
        return $written;
    }
1222798
public function write()
	{
		// do we have something to write?
		if ( ! empty($this->keys) or ! empty($this->data) or ! empty($this->flash))
		{
			parent::write();

			// rotate the session id if needed
			$this->rotate(false);

			// record the last update time of the session
			$this->keys['updated'] = $this->time->get_timestamp();

			// session payload
			$payload = $this->_serialize(array($this->keys, $this->data, $this->flash));

			// create the session file
			$this->_write_memcached($this->keys['session_id'], $payload);

			// was the session id rotated?
			if ( isset($this->keys['previous_id']) and $this->keys['previous_id'] != $this->keys['session_id'])
			{
				// point the old session file to the new one, we don't want to lose the session
				$payload = $this->_serialize(array('rotated_session_id' => $this->keys['session_id']));
				$this->_write_memcached($this->keys['previous_id'], $payload);
			}

			$this->_set_cookie(array($this->keys['session_id']));
		}

		return $this;
	}
109356
public function write()
	{
		// do we have something to write?
		if ( ! empty($this->keys) or ! empty($this->data) or ! empty($this->flash))
		{
			parent::write();

			// rotate the session id if needed
			$this->rotate(false);

			// record the last update time of the session
			$this->keys['updated'] = $this->time->get_timestamp();

			// then update the cookie
			$this->_set_cookie(array($this->keys, $this->data, $this->flash));
		}

		return $this;
	}
313575
public function closeWrite()
    {
        if ($this->bevWrite) {
            if (isset($this->bevWrite)) {
                $this->bevWrite->free();
            }
            $this->bevWrite = null;
        }

        if ($this->fdWrite) {
            fclose($this->fdWrite);
            $this->fdWrite = null;
        }

        return $this;
    }
525554
public function logout()
    {
        if ($this->instance instanceof \Phavour\Session\Storage) {
            if ($this->instance->isLocked()) {
                $this->instance->unlock();
            }
            $this->instance->destroy();
        }

        return false;
    }
821462
public function startSession()
    {
        $swooleSession = SwooleSession::component();
        $swooleSession->gc(time());
        $swooleSession->write($this->getSessionId(), Lb::app()->serialize([]));
        return true;
    }
753389
private function destroyUserData()
    {

        if (is_array($this->user) === true
            && isset($this->user["error"]) === true
        ) {
            $this->user = false;
            return true;
        }
        return false;
    }
445418
public function close()
	{
		$writer = PHPExcel_IOFactory::createWriter( $this->_container, $this->_format );
		$writer->save( $this->_resourcepath );
	}
93334
public function close()
    {
        if ($this->gcCalled) {
            $this->gcCalled = false;

            // delete the session records that have expired
            $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time";

            $stmt = $this->db->query($sql)
                        ->bind(':time', time())
                        ->execute();
        }

        return true;
    }
988490
public function write(
        /*# string */ $session_id,
        /*# string */ $session_data
    )/*# : bool */ {
        $file = $this->getSessionFile($session_id);
        return file_put_contents($file, $session_data) !== false;
    }
977496
final public function close()
    {

        $this->onCloseConnection();

        if($this->socket){
            $this->write("</stream:stream>");
            parent::close();
            $this->connected = false;
        }

    }