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;
    }