Terminates the session.  It schedules the ``close()`` coroutine
        of the underlying aiohttp session and then enqueues a sentinel
        object to indicate termination.  Then it waits until the worker
        thread to self-terminate by joining.
355503
def close(self):
        '''
        
        '''
        if self._closed:
            return
        self._closed = True
        self._worker_thread.work_queue.put(self.aiohttp_session.close())
        self._worker_thread.work_queue.put(self.worker_thread.sentinel)
        self._worker_thread.join()
307269
def close(self):
        
        if self._server is None:
            raise RuntimeError('Server is not started')
        self._server.close()
        for handler in self._handlers:
            handler.close()
475189
def _close(self):
        
        if self._process is None:
            return

        self.quit()

        self._process.stdin.close()

        logger.debug("Waiting for ssh process to finish...")
        self._process.wait()  # Wait for ssh session to finish.

        # self._process.terminate()
        # self._process.kill()

        self._process = None
57424
def close(self):
        
        if not self._closed:
            closed = False
            event = self.event('connection_lost')
            if self.transport:
                if self._loop.get_debug():
                    self.logger.debug('Closing connection %s', self)
                if self.transport.can_write_eof():
                    try:
                        self.transport.write_eof()
                    except Exception:
                        pass
                try:
                    worker = self.close_pipeline()
                    self.transport.close()
                    closed = self._loop.create_task(
                        self._close(event.waiter(), worker)
                    )
                except Exception:
                    pass
            self._closed = closed or True
            if not closed:
                event.fire()
        return self._closed
326496
def close(self):
        
        conn = self.connection
        if conn is None:
            return
        try:
            while self.nextset():
                pass
        finally:
            self.connection = None
1266551
async def close(self, code: int = 1006, reason: str = "Connection closed"):
        
        if self._closed:
            return

        self._closed = True

        if self._scope is not None:
            await self._scope.cancel()
            # cancel any outstanding listeners

        data = self._connection.send(CloseConnection(code=code, reason=reason))
        await self._sock.send_all(data)

        # No, we don't wait for the correct reply
        await self._sock.close()
317821
def close(self):
        
        if not self._closed:
            self.add_event(self._sentinel_event)
            self.flush()
            self._worker.join()
            self._ev_writer.close()
            self._closed = True
579612
def close_session(self):
        
        with self._graph.as_default():
            self._sess.close()
            self._sess = None
399980
def quit(self, exit_code=0, event=None):
        

        # --- Running on_close components methods. ---
        for component in reversed(self.__components_manager.list_components()):
            interface = self.__components_manager.get_interface(component)
            if not interface:
                continue

            if not interface.activated:
                continue

            if not hasattr(interface, "on_close"):
                continue

            if not interface.on_close():
                event and event.ignore()
                return

        # Storing current layout.
        self.__layouts_manager.store_startup_layout()
        self.__settings.settings.sync()

        # Stopping worker threads.
        for worker_thread in self.__worker_threads:
            LOGGER.debug("> Stopping worker thread: '{0}'.".format(worker_thread))
            if not worker_thread.isFinished():
                worker_thread.quit()
            worker_thread.wait()

        foundations.verbose.remove_logging_handler(self.__logging_file_handler)
        foundations.verbose.remove_logging_handler(self.__logging_session_handler)
        # foundations.verbose.remove_logging_handler(self.__logging_console_handler)

        # Stopping the Application timer.
        self.__timer.stop()
        self.__timer = None

        self.deleteLater()
        event and event.accept()

        exit(exit_code)
707663
async def close(self, *, timeout=None):
        
        try:
            if not self.is_closed():
                await self._protocol.close(timeout)
        except Exception:
            # If we fail to close gracefully, abort the connection.
            self._abort()
            raise
        finally:
            self._cleanup()
1197958
def finish(self):
        ""
        log.debug("Session disconnected.")
        try:
            self.sock.shutdown(socket.SHUT_RDWR)
        except: pass
        self.session_end()
962156
@EventThread
    public void endSession ()
    {
        _clmgr.clientSessionWillEnd(this);

        // queue up a request for our connection to be closed (if we have a connection, that is)
        Connection conn = getConnection();
        if (conn != null) {
            // go ahead and clear out our connection now to prevent funniness
            setConnection(null);
            // have the connection manager close our connection when it is next convenient
            _conmgr.closeConnection(conn);
        }

        // if we don't have a client object, we failed to resolve in the first place, in which case
        // we have to cope as best we can
        if (_clobj != null) {
            // and clean up after ourselves
            try {
                sessionDidEnd();
            } catch (Exception e) {
                log.warning("Choked in sessionDidEnd " + this + ".", e);
            }

            // release (and destroy) our client object
            _clmgr.releaseClientObject(_clobj.username);

            // we only report that our session started if we managed to resolve our client object,
            // so we only report that it ended in the same circumstance
            _clmgr.clientSessionDidEnd(this);
        }

        // we always want to clear ourselves out of the client manager
        _clmgr.clearSession(this);

        // clear out the client object so that we know the session is over
        _clobj = null;
    }
1182823
def close(self):
        
        try:
            self._close()
            if hasattr(self.stream_lock, 'closed') and \
                    not self.stream_lock.closed:
                self.stream_lock.close()
        finally:
            self.stream_lock = None
            if Handler:
                Handler.close(self)
986110
def terminate(self, nowait=False):
        
        logger.debug("Acquiring lock for service termination")
        with self.lock:
            logger.debug("Terminating service")

            if not self.listener:
                logger.warning("Service already stopped.")
                return

            self.listener.stop(nowait)

            try:
                if not nowait:
                    self._post_log_batch()
            except Exception:
                if self.error_handler:
                    self.error_handler(sys.exc_info())
                else:
                    raise
            finally:
                self.queue = None
                self.listener = None
606650
def close(self):
        
        if (self.__ser is not None):
            self.__ser.close()
        if (self.__tcpClientSocket is not None):
            self.__stoplistening = True
            self.__tcpClientSocket.shutdown(socket.SHUT_RDWR)
            self.__tcpClientSocket.close()
        self.__connected = False
697365
def close &on_disconnect
      @heartbeat_timer.cancel if @heartbeat_timer
      @heartbeat_timer = nil
      if on_disconnect
        @closing = true
        @on_disconnect = proc{
          on_disconnect.call
          @closing = false
        }
      end

      callback{ |c|
        if c.channels.any?
          c.channels.each do |ch, mq|
            mq.close
          end
        else
          send Protocol::Connection::Close.new(:reply_code => 200,
                                               :reply_text => 'Goodbye',
                                               :class_id => 0,
                                               :method_id => 0)
        end
      }
    end
845856
def terminate(self):
        
        rs = self.connection.terminate_instances([self.id])
        if len(rs) > 0:
            self._update(rs[0])