Close an open tunnel.

@param array $tunnel

@return bool
True on success, false on failure.
967150
protected function closeTunnel(array $tunnel)
    {
        $success = true;
        if (isset($tunnel['pid']) && function_exists('posix_kill')) {
            /** @noinspection PhpComposerExtensionStubsInspection */
            $success = posix_kill($tunnel['pid'], SIGTERM);
            if (!$success) {
                /** @noinspection PhpComposerExtensionStubsInspection */
                $this->stdErr->writeln(sprintf(
                    'Failed to kill process <error>%d</error> (POSIX error %s)',
                    $tunnel['pid'],
                    posix_get_last_error()
                ));
            }
        }
        $pidFile = $this->getPidFile($tunnel);
        if (file_exists($pidFile)) {
            $success = unlink($pidFile) && $success;
        }
        $this->tunnelInfo = array_filter($this->tunnelInfo, function ($info) use ($tunnel) {
            return !$this->tunnelsAreEqual($info, $tunnel);
        });
        $this->saveTunnelInfo();

        return $success;
    }
1211195
public function finish(array $items = [])
    {
        foreach ($items as $item) {
            if (is_null(array_get($this->keyMap, $item))) {
                $explode = explode('.', $item);
                $this->saving($explode[0], $explode[1]);
            }
        }
        return true;
    }
854064
function closeUserSock($user)
    {
        fclose($this->users[$user]['sock']);
        $this->users[$user]['sock'] = 0;
        return true;
    }
1277505
public void close() throws IOException {
        if ( session != null && session.isConnected() ) {
            session.disconnect();
        }
        session = null;

        // unnecessary, but seems right to undo what we did
        for ( Tunnel tunnel : tunnels ) {
            tunnel.setAssignedLocalPort( 0 );
        }
    }
911754
public function close( $quit = FALSE )
	{
		if( !$quit )
			$this->checkConnection( TRUE, FALSE );
		if( !@ftp_quit( $this->resource ) )
			return FALSE;
		$this->auth		= FALSE;
		$this->resource	= NULL;
		return TRUE;
	}
1322626
public static function closeInstance(array $names = array())
    {
        if (empty(self::$instances)) {
            return true;
        }

        if (empty($names)) {
            foreach (self::$instances as $name => $redis) {
                if (self::$configs[$name]['pconnect']) {
                    continue;
                }
                $redis->close();
                unset(self::$configs[$name]);
            }
        } else {
            foreach ($names as $name) {
                if (isset(self::$instances[$name])) {
                    if (self::$configs[$name]['pconnect']) {
                        continue;
                    }
                    self::$instances[$name]->close();
                    unset(self::$configs[$name]);
                }
            }
        }

        return true;
    }
559961
public function close($options)
    {
        if (!is_array($options)) $options = ['out_trade_no' => $options];
        $this->options->set('method', 'alipay.trade.close');
        return $this->getResult($options);
    }
525472
function _close()
	{
		if ($this->_connectionID) $this->_connectionID->Close();
		$this->_connectionID = false;
		return true;
	}
682850
public static function closeBuffer($path)
    {
        if (!self::$readers) {
            return false;
        }

        $path = new XMLSequenceStreamPath($path);
        $file = $path->getFile();

        return self::$readers->removeReaderForFile($file);
    }
1063217
public function purgeUrls(array $urls)
    {
        foreach ($urls as $url) {
            $success = $this->sendPurgeRequest([
                    'url'      => $url,
                    'headers'  => $this->headers
                ]
            );

            if (!$success) {
                return false;
            }
        }

        return true;

    }
1315091
public function close() {
		if (DEBUG_MODE) {
			BLog::addToLog('[Users.Session]: close()');
		}
		setcookie('brillsecret', '', time() - 3600, '/', BHOSTNAME);
		if (DEBUG_MODE) {
			BLog::addToLog('[Users.Session] close session');
		}
		if (!$db = BFactory::getDBO()) {
			return false;
		}
		$bCache = BFactory::getCache();
		if ($bCache) {
			$bCache->delete('session:' . $this->sessionid);
		}
		$q = $db->Query('delete from sessions where sessionid=' . $db->escapeString($this->sessionid));
		if (empty($q)) {
			BLog::addToLog('[Users.Session]: close(): Could not execute query! MySQL error: ' . $db->lasterror(), LL_ERROR);
			return false;
		}
		return true;
	}
1103704
public function close()
    {
        // call QGYCLST, the "close list" api.
        $apiPgm = 'QGYCLST';
        $apiLib = 'QSYS';

        $requestHandle = $this->_requestHandle;

        $paramXml = "<parm io='in' comment='1. request handle'>
                      <data var='requestHandle' comment='Request handle: binary/hex' type='4b'>$requestHandle</data>
                    </parm>\n" . Toolkit::getErrorDataStructXml(2); // param number 2

        // pass param xml directly in.
        $this->ToolkitSrvObj->PgmCall($apiPgm, $apiLib, $paramXml);

        // GUI0006 means end of list
        if ($this->ToolkitSrvObj->getErrorCode()) {
            return false;
        } else {
            return true;
        }
    }
737108
public function close()
    {
        if($this->getType() == 'temp')
        {
            if(parent::close() == true)
            {
                //Only unlink temporary files
                if($this->getType() == 'temp') {
                    $this->unlink();
                }

                return true;
            }
        }

        if($this->getType() == 'memory') {
            return $this->flush();
        }

        return false;
    }
133167
def close(self):
        '''
        
        '''
        if self._closing:
            return
        self._closing = True
        if hasattr(self.sock, 'close'):
            self.sock.close()
509338
public function endsWith( $needles ) : bool
    {
        foreach( (array)$needles as $needle ){
            if( substr( $this->__toString(), - strlen( $needle ) ) === (string)$needle ){
                return true;
            }
        }
        return false;
    }
256351
public function close()
    {
        $this->handlerLock = true;

        while (count($this->handlers) > 0) {
            array_pop($this->handlers);
            $this->stacks['delete']->pop();
            $this->stacks['clean']->pop();
            $this->stacks['create']->pop();
            $this->stacks['read']->pop();
            $this->stacks['write']->pop();
        }

        $this->handlerLock = false;
        return true;
    }
781165
public static function delete(array &$array, string $path): bool
	{
		$segments = explode('.', $path);

		while(count($segments) > 1)
		{
			$segment = array_shift($segments);

			if(!isset($array[$segment]) || !is_array($array[$segment]))
			{
				return false;
			}

			$array =& $array[$segment];
		}

		unset($array[array_shift($segments)]);

		return true;
	}