public function shutdownObject()
    {
        if ($this->started === true && $this->remote === false) {
            if ($this->metaDataCache->has($this->sessionIdentifier)) {
                // Security context can't be injected and must be retrieved manually
                // because it relies on this very session object:
                $securityContext = $this->objectManager->get(Context::class);
                if ($securityContext->isInitialized()) {
                    $this->storeAuthenticatedAccountsInfo($securityContext->getAuthenticationTokens());
                }

                $this->putData('Neos_Flow_Object_ObjectManager', $this->objectManager->getSessionInstances());
                $this->writeSessionMetaDataCacheEntry();
            }
            $this->started = false;

            $decimals = (integer)strlen(strrchr($this->garbageCollectionProbability, '.')) - 1;
            $factor = ($decimals > -1) ? $decimals * 10 : 1;
            if (rand(1, 100 * $factor) <= ($this->garbageCollectionProbability * $factor)) {
                $this->collectGarbage();
            }
        }
    }