Closes the voice client.

@return \React\Promise\Promise
344834
public function close()
    {
        $deferred = new Deferred();

        if (! $this->ready) {
            $deferred->reject(new \Exception('Voice Client is not connected.'));

            return $deferred->promise();
        }

        $this->stop();
        $this->setSpeaking(false);
        $this->ready = false;

        $this->mainSend([
            'op' => Op::OP_VOICE_STATE_UPDATE,
            'd'  => [
                'guild_id'   => $this->channel->guild_id,
                'channel_id' => null,
                'self_mute'  => true,
                'self_deaf'  => true,
            ],
        ]);

        $this->client->close();
        $this->voiceWebsocket->close();

        $this->heartbeat_interval = null;
        $this->loop->cancelTimer($this->heartbeat);
        $this->loop->cancelTimer($this->udpHeartbeat);
        $this->heartbeat      = null;
        $this->udpHeartbeat   = null;
        $this->seq            = 0;
        $this->timestamp      = 0;
        $this->sentLoginFrame = false;
        $this->startTime      = null;
        $this->streamTime     = 0;
        $this->speakingStatus = new Collection([], 'ssrc');

        $this->emit('close');

        $deferred->resolve();

        return $deferred->promise();
    }
273331
public function stopRecording(): Handle
    {
        foreach (get_object_vars($this->state->stubs) as $stub) {
            $stub->stopRecording();
        }

        $this->state->isRecording = false;

        return $this;
    }
1154123
public function dir_closedir() {
    assert(isset($this->client));
    $this->client->close();
    $this->client = null;
  }
1367952
public function stop()
  {
    $this->end = microtime(true);
    return bcsub($this->end, $this->start, 2);
  }
83509
public function disconnect(): self
    {
        if ($this->isConnected()) {
            pg_close($this->resource);
            $this->resource = null;
        }

        return $this;
    }
194695
function delete($timeout = 0, string $reason = '') {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($timeout, $reason) {
            if($timeout > 0) {
                $this->client->addTimer($timeout, function () use ($reason, $resolve, $reject) {
                    $this->delete(0, $reason)->done($resolve, $reject);
                });
            } else {
                $this->client->apimanager()->endpoints->channel->deleteMessage($this->channel->getId(), $this->id, $reason)->done(function () use ($resolve) {
                    $resolve();
                }, $reject);
            }
        }));
    }
29354
public function close()
    {
        if (!$this->handle) return false;
        $status = $this->fs->fclose($this->handle);
        $this->handle = false;
        return $status;
    }
273471
public function disconnect()
    {
        if (!$this->socket) {
            return $this;
        }

        try {
            $this->send('QUIT');
        } catch (Argument $e) {
            // ignore error - we're closing the socket anyway
        }

        fclose($this->socket);
        $this->socket = null;

        return $this;
    }
262048
public function close()
    {
        $this->log('close socket connection');

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

        return $state;
    }
862989
public function close(){
		switch($this->getMode()){
			case 'w':
			case 'wb':
			case 'a':
			case 'a+':
				$this->sync();
				$url = $this->getURI();
				return $this->call($url,array(
					 'action'	=>	self::FILE_IO_STORE
					,'path'		=>	$this->path
				));
				break;
			case 'r':
			case 'rb':
			default:
				return microtime(true);
				break;
		}
		return true;
	}
15817
public function disconnect() {
        if ($this->isConnected() && $this->connection !== false && is_integer($this->connection) === false) {
            $this->errors = array_merge($this->errors, imap_errors() ?: []);
            $this->connected = !imap_close($this->connection, IMAP::CL_EXPUNGE);
        }

        return $this;
    }
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;
        }
    }
542602
public function closeAll()
    {
        $open = array();
        foreach ($this->states as $key => $state) {
            if ($state->isOpen()) {
                $state->close();
                $open[] = $key;
            }
        }
        return $open;
    }
603226
public function disconnect()
    {
        if (false === $this->connected) {
            return true;
        }

        if ($this->socket) {
            $this->send(WebsocketPayload::generateClosePayload(), WebsocketPayload::OPCODE_CLOSE);
            $this->closing = true;

            $payloadLength = ord(fread($this->socket, 1));
            $payload = fread($this->socket, $payloadLength);

            if ($this->closing) {
                $this->closing = false;
            } else {
                if ($payloadLength >= 2) {
                    $bin = $payload[0] . $payload[1];
                    $status = bindec(sprintf('%08b%08b', ord($payload[0]), ord($payload[1])));

                    $this->send($bin . 'Close acknowledged: ' . $status, WebsocketPayload::OPCODE_CLOSE);
                }
            }

            fclose($this->socket);
            $this->connected = false;

            return true;
        }

        return false;
    }
1049010
public function getVoiceClient($id)
    {
        if (isset($this->voiceClients[$id])) {
            return \React\Promise\resolve($this->voiceClients[$id]);
        }

        return \React\Promise\reject(new \Exception('Could not find the voice client.'));
    }
1107386
async def close(self):
        
        if self.is_closed():
            return

        self._closed = True

        for vc in self.voice_clients:
            try:
                await vc.disconnect()
            except Exception:
                pass

        to_close = [shard.ws.close() for shard in self.shards.values()]
        if to_close:
            await asyncio.wait(to_close, loop=self.loop)

        await self.http.close()
893545
public function finish()
    {
        // Re-sync before shutting down.
        foreach ($this->drivers as $acl) {
            $acl->sync();
        }

        $this->drivers = [];

        return $this;
    }