Shuts down the event loop. This basically exits the process.
@return boolean
421318
public function prepareShutdown()
    {
        if ($this->inShutdown) {
            return false;
        }

        if ($this->errorLogger && $logs = $this->errorLogger->cleanLogs()) {
            $messages = array_map(
                function ($item) {
                    //array($level, $message, $context);
                    $message = $item[1];
                    $context = $item[2];

                    if (isset($context['file'])) {
                        $message .= ' in ' . $context['file'] . ':' . $context['line'];
                    }

                    if (isset($context['stack'])) {
                        foreach ($context['stack'] as $idx => $stack) {
                            $message .= PHP_EOL . sprintf(
                                "#%d: %s%s %s%s",
                                $idx,
                                isset($stack['class']) ? $stack['class'] . '->' : '',
                                $stack['function'],
                                isset($stack['file']) ? 'in' . $stack['file'] : '',
                                isset($stack['line']) ? ':' . $stack['line'] : ''
                            );
                        }
                    }
                    return $message;
                },
                $logs
            );
            error_log(implode(PHP_EOL, $messages));
        }

        $this->inShutdown = true;

        $this->sendCurrentFiles();

        // $this->controller->close() is no longer called here, because it prevented
        // shutdown functions from triggering (see https://github.com/php-pm/php-pm/pull/432)

        if ($this->server) {
            @$this->server->close();
        }

        if ($this->loop) {
            $this->loop->stop();
        }

        return true;
    }
100129
public function disconnect() {
    if ($this->connected) {
      if (is_a($this->link, 'SQLite3')) {
        $this->link->exec("PRAGMA optimize;");
        $this->link->close();
      }
      $this->connected = false;
    }
    return $this->connected;
  }
351767
public function close() {
		$result = fclose($this->file);
		if($result == true) {
			$this->open = false;
			return true;
		}
		return false;
	}
794383
public boolean shutdown() {
    mServer.shutdown();
    try {
      return mServer.awaitTermination(mServerShutdownTimeoutMs, TimeUnit.MILLISECONDS);
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
      return false;
    } finally {
      mServer.shutdownNow();
    }
  }
514341
public function close()
    {
        if ($this->_stmt) {
            $r = $this->_stmt->close();
            $this->_stmt = null;
            return $r;
        }
        return false;
    }
459373
public function stop()
	{
		if ($this->is_started())
		{
			$this->delete('session');
			$this->_pid = NULL;
		}

		if ($this->_pid_file AND is_file($this->_pid_file))
		{
			unlink($this->_pid_file);
		}
		$self = $this;

		return Attempt::make(function() use ($self) {
			return ! $self->is_running();
		});
	}
1178526
public function disconnect()
    {
        if (!$this->connected || !$this->server || ($this->mode ==  "mysql" && $this->server->connect_error)) {
            return false;
        }

        $result = false;

        switch ($this->mode) {

            case "mysql":
            case "sqlite":
                $result = $this->server->close();
                break;

            case "postgres":
            case "redshift":
                $result = pg_close($this->server);
                break;

            case "odbc":
                odbc_close($this->server);
                $result = true;
                break;

            case "mssql":
                $result = mssql_close($this->server);
                break;

            case "mssqlsrv":
                $result = sqlsrv_close($this->server);
                break;
        }

        # If the disconnect was successful, set class property to reflect it
        if ($result) {
            $this->connected = false;
        }

        return $result;
    }
491432
public function logout() {
		$this->logger->log( LogLevel::DEBUG, 'Logging out' );
		$result = $this->postRequest( new SimpleRequest( 'logout' ) );
		if ( $result === [] ) {
			$this->isLoggedIn = false;
			$this->clearTokens();
			return true;
		}
		return false;
	}
466282
function close()
    {
        /* If we haven't been opened, there's nothing more to do. */
        if (!$this->_opened) {
            return true;
        }

        /* Attempt to close each of our children. */
        $closed = true;
        foreach ($this->_children as $child) {
            if ($child->_opened) {
                $closed &= $child->close();
            }
        }

        /* Clear the opened state for consistency. */
        $this->_opened = false;

        /* If all children were closed, return success. */
        return $closed;
    }
177306
public function stop()
    {

        // start container shutdown
        $this->synchronized(function ($self) {
            $self->containerState = ContainerStateKeys::get(ContainerStateKeys::HALT);
        }, $this);

        do {
            // wait for 0.5 seconds
            usleep(500000);

            // log a message that we'll wait till application has been shutdown
            $this->getInitialContext()->getSystemLogger()->info(
                sprintf('Wait for container %s to be shutdown', $this->getContainerNode()->getName())
            );

            // query whether application state key is SHUTDOWN or not
            $waitForShutdown = $this->synchronized(function ($self) {
                return $self->containerState->notEquals(ContainerStateKeys::get(ContainerStateKeys::SHUTDOWN));
            }, $this);

        } while ($waitForShutdown);
    }
27406
public function disconnect()
    {
        if (!is_resource($this->fp)) {
            return $this->raiseError('not connected');
        }

        @fclose($this->fp);
        $this->fp = null;

        return true;
    }
554438
public function disconnect()
    {
        if (!is_resource($this->connection)) {
            $this->connected = false;

            return true;
        }
        $this->connected = !fclose($this->connection);

        if (!$this->connected) {
            $this->connection = null;
        }

        return !$this->connected;
    }
155056
private function close(): int
    {
        $this->processPipes->close();
        if (\is_resource($this->process)) {
            proc_close($this->process);
        }
        $this->exitcode = $this->processInformation['exitcode'];
        $this->status = self::STATUS_TERMINATED;

        if (-1 === $this->exitcode) {
            if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
                // if process has been signaled, no exitcode but a valid termsig, apply Unix convention
                $this->exitcode = 128 + $this->processInformation['termsig'];
            } elseif ($this->isSigchildEnabled()) {
                $this->processInformation['signaled'] = true;
                $this->processInformation['termsig'] = -1;
            }
        }

        // Free memory from self-reference callback created by buildCallback
        // Doing so in other contexts like __destruct or by garbage collector is ineffective
        // Now pipes are closed, so the callback is no longer necessary
        $this->callback = null;

        return $this->exitcode;
    }
232118
final public function shutdown() : void
    {
        $this->__call('shutdown');
        Master::wait($this->backend->process()->pid ?? -2);
    }
938197
public function close()
    {
        if ($this->_socket === false) {
            $this->_error = 'not connected';

            return false;
        }

        fclose($this->_socket);
        $this->_socket = false;

        return true;
    }
696662
private function quit()
    {
        $this->output->writeln('Stopping the process manager.');

        // this method is also called during startup when something crashed, so
        // make sure we don't operate on nulls.
        if ($this->controller) {
            @$this->controller->close();
        }
        if ($this->web) {
            @$this->web->close();
        }

        if ($this->loop) {
            $this->loop->stop();
        }

        unlink($this->pidfile);
        exit;
    }
1177777
public function disconnect() {

        if(!$this->isConnected())
            return false;

        try {
            $this->connection->close();
        } catch (Exception $e){
            return false;
        }

        return true;
    }