// Closes a tab based off the tab id.
555697
func (auto *AutoGcd) CloseTabById(id string) error {
	tab, err := auto.tabById(id)
	if err != nil {
		return err
	}
	auto.CloseTab(tab)
	return nil
}
198469
func (c *unsignedArrayAscendingCursor) Close() {
	if c.tsm.keyCursor != nil {
		c.tsm.keyCursor.Close()
		c.tsm.keyCursor = nil
	}
	c.cache.values = nil
	c.tsm.values = nil
}
20644
func (term *terminal) Close() error {
	if term.supportsEditing {
		err := setTermios(term.fd, false, &term.origMode)
		if err != nil {
			return err
		}
	}

	return nil
}
210674
func (ts *TiDBStatement) Close() error {
	//TODO close at tidb level
	err := ts.ctx.session.DropPreparedStmt(ts.id)
	if err != nil {
		return err
	}
	delete(ts.ctx.stmts, int(ts.id))

	// close ResultSet associated with this statement
	if ts.rs != nil {
		terror.Call(ts.rs.Close)
	}
	return nil
}
410993
func (c *Cursor) Close() error {
	if c == nil {
		return errNilCursor
	}

	c.mu.Lock()
	defer c.mu.Unlock()

	var err error

	// If cursor is already closed return immediately
	closed := c.closed
	if closed {
		return nil
	}

	// Get connection and check its valid, don't need to lock as this is only
	// set when the cursor is created
	conn := c.conn
	if conn == nil {
		return nil
	}
	if conn.Conn == nil {
		return nil
	}

	// Stop any unfinished queries
	if !c.finished {
		_, _, err = conn.Query(c.ctx, newStopQuery(c.token))
	}

	if c.releaseConn != nil {
		if err := c.releaseConn(); err != nil {
			return err
		}
	}

	if span := opentracing.SpanFromContext(c.ctx); span != nil {
		span.Finish()
	}

	c.closed = true
	c.conn = nil
	c.buffer = nil
	c.responses = nil

	return err
}
1257534
func (remote *RemoteDebugger) ActivateTab(tab *Tab) error {
	resp, err := responseError(remote.http.Get("/json/activate/"+tab.ID, nil, nil))
	resp.Close()

	if err == nil {
		err = remote.connectWs(tab)
	}

	return err
}
1249795
func (t Texture) Close() {
	if !engo.Headless() {
		engo.Gl.DeleteTexture(t.id)
	}
}
508977
func (c *Client) Close() error {
	if c.db != nil {
		return c.db.Close()
	}
	return nil
}
506922
func (t *Tab) RemoveScriptFromOnLoad(scriptId string) error {
	_, err := t.Page.RemoveScriptToEvaluateOnLoad(scriptId)
	return err
}
34516
func (t *explainTablet) Close(ctx context.Context) error {
	return t.tsv.Close(ctx)
}
1107792
func Close(ctx context.Context, c io.Closer) {
	// need to verify that the value of the `c` interface if not nil, too
	if c != nil && !reflect.ValueOf(c).IsNil() {
		err := c.Close()
		if err != nil {
			log.Error(ctx, map[string]interface{}{"error": err.Error()}, "error while closing the resource")
		}
	}

}
1246416
func (c *Connection) Close() error {
	c.lock.Lock()
	defer c.lock.Unlock()

	if c.client != nil {
		err := c.client.Close()
		for waiterID := range c.closeWaiters {
			close(c.closeWaiters[waiterID])
		}
		c.client = nil
		return err
	}
	return nil
}
18818
func (auto *AutoGcd) ActivateTabById(id string) error {
	tab, err := auto.tabById(id)
	if err != nil {
		return err
	}
	return auto.ActivateTab(tab)
}
1049275
func (c *integerArrayAscendingCursor) Close() {
	if c.tsm.keyCursor != nil {
		c.tsm.keyCursor.Close()
		c.tsm.keyCursor = nil
	}
	c.cache.values = nil
	c.tsm.values = nil
}
310214
func (s *Stmt) Close() error {
	s.closemu.Lock()
	defer s.closemu.Unlock()

	if s.stickyErr != nil {
		return s.stickyErr
	}
	s.mu.Lock()
	if s.closed {
		s.mu.Unlock()
		return nil
	}
	s.closed = true

	if s.tx != nil {
		s.txsi.Close()
		s.mu.Unlock()
		return nil
	}
	s.mu.Unlock()

	return s.db.removeDep(s, s)
}
1193847
func (dc *DatabasePluginClient) Close() error {
	err := dc.Database.Close()
	dc.client.Kill()

	return err
}
274731
func (v *view) close() error {
	v.mu.Lock()
	defer v.mu.Unlock()

	// Close all fragments.
	for _, frag := range v.fragments {
		if err := frag.Close(); err != nil {
			return errors.Wrap(err, "closing fragment")
		}
	}
	v.fragments = make(map[uint64]*fragment)

	return nil
}