/// <summary>
        /// Closes the connection and yields (waits for it to be closed)
        /// </summary>
        public IEnumerator Close()
        {
            if (Authorized)
            {
                // End the root context
                if (_authorizationContext != null)
                {
                    EndAuthorizationContext();
                }

                // Force client to send the data to the server immidiately, ignore the ChunkLifeTime and chunk max length
                ResetActiveChunk();

                // Wait for the next ProcessBulkedRequests call to send the chunk - IF there is a net connection
                if (IsAvailable)
                {
                    yield return(CoroutineManager.StartCoroutine(WaitForAllChunksToBeProcessed()));
                }

                if (_processBulkRequestCoroutine != null)
                {
                    CoroutineManager.StopCoroutine(_processBulkRequestCoroutine);
                }

                if (_trackContextDataCoroutine != null)
                {
                    CoroutineManager.StopCoroutine(_trackContextDataCoroutine);
                }

                // Unsubscribe from events
                JsonRpcClient.OnLostConnection -= OnLostConnection;
                JsonRpcClient.OnReconnected    -= OnReconnected;

                // Reset Authorized on the AuthorizationStartategy
                AuthorizationStrategy.ResetAuthorization();
            }

            yield return(CoroutineManager.StartCoroutine(JsonRpcClient.Close()));
        }