// Close implements the Executor Close interface.
496676
func (e *WindowExec) Close() error {
	e.childResults = nil
	return errors.Trace(e.baseExecutor.Close())
}
586699
func (w *worker) Close() {
	w.mu.Lock()
	w.closed = true
	w.mu.Unlock()

	w.taskevents.Close()
}
404399
func (w *StdWriter) Close() {
	if w.buffer.Len() > 0 {
		w.write(w.buffer.Bytes())
	}
}
380612
func (w *writeCloseInformer) Close() error {
	err := w.wc.Close()
	close(w.close)
	return err
}
977979
func (w *WriteOnCloser) Close() error {
	if !w.hasWritten {
		_, err := w.Write(nil)
		if err != nil {
			return err
		}
	}
	if closer, ok := w.Writer.(io.Closer); ok {
		return closer.Close()
	}
	return nil
}
383995
func (queue *redisQueue) Close() bool {
	queue.PurgeRejected()
	queue.PurgeReady()
	count, _ := queue.redisClient.SRem(queuesKey, queue.name)
	return count > 0
}
1068401
func (iter *iterator) Close() error {
	if iter.lowerLevelIter != nil {
		iter.lowerLevelIter.Close()
		iter.lowerLevelIter = nil
	}

	if iter.closer != nil {
		iter.closer.Close()
		iter.closer = nil
	}

	return nil
}
335219
func (this *BufferedWriter) Close() error {
	close(this.queue)
	<-this.done
	return nil
}
1285874
func (wf *WriteFlusher) Close() error {
	wf.closeLock.Lock()
	defer wf.closeLock.Unlock()

	select {
	case <-wf.closed:
		return errWriteFlusherClosed
	default:
		close(wf.closed)
	}
	return nil
}
1124883
func (c *cursor) Close() error {
	if c == nil {
		// Avoid panics in the case that someone defer's a close before checking that the cursor is not nil.
		return nil
	}
	if c := atomic.LoadInt32(&c.closed); c != 0 {
		return nil
	}
	c.closeMutex.Lock()
	defer c.closeMutex.Unlock()
	if c.closed == 0 {
		if c.cursorData.ID != "" {
			// Force use of initial endpoint
			ctx := WithEndpoint(nil, c.endpoint)

			req, err := c.conn.NewRequest("DELETE", path.Join(c.relPath(), c.cursorData.ID))
			if err != nil {
				return WithStack(err)
			}
			resp, err := c.conn.Do(ctx, req)
			if err != nil {
				return WithStack(err)
			}
			if err := resp.CheckStatus(202); err != nil {
				return WithStack(err)
			}
		}
		atomic.StoreInt32(&c.closed, 1)
	}
	return nil
}
290031
func (ref *AsyncProducer) Close(async ...bool) error {
	var err error
	defer func() {
		if ref.closed {
			ref.Unlock()
			return
		}
		ref.closed = true
		close(ref.closeChannel)

		// decrement external wait group
		if ref.xwg != nil {
			ref.xwg.Done()
		}
		ref.Unlock()
	}()

	ref.Lock()
	if ref.closed {
		return nil
	}

	if async != nil && len(async) > 0 {
		ref.Debug("async close")
		ref.Producer.AsyncClose()
	} else {
		ref.Debug("sync close")
		ref.Producer.Close()
	}
	if err != nil {
		ref.Errorf("asyncProducer close error: %v", err)
		return err
	}
	if ref.Client != nil && !ref.Client.Closed() {
		err = ref.Client.Close()
		if err != nil {
			ref.Errorf("client close error: %v", err)
			return err
		}
	}

	return nil
}
250773
func (loop Loop) Close() error {
	errc := make(chan error)
	loop.closing <- errc
	return <-errc
}
667046
func (cp *CachePool) Close() error {
	err := cp.source.Close()
	if err != nil {
		return errors.WithStack(err)
	}

	err = cp.cache.Close()
	if err != nil {
		return errors.WithStack(err)
	}

	return nil
}
82913
func (c *Client) Close() error {
	if c.conn != nil {
		return c.conn.Close()
	}
	return nil
}
1144197
func (e *ExecIO) Close() error {
	if e.closer != nil {
		e.closer.Close()
	}
	if e.fifos != nil {
		return e.fifos.Close()
	}
	return nil
}
1337467
func (p *parallelHostChecker) Close() error {
	// We signal each checker to stop and wait for them
	// each to complete; this allows us to get the error,
	// as opposed to when using try.Kill which does not
	// wait for the functions to complete.
	p.Try.Close()
	for _, ch := range p.active {
		close(ch)
	}
	return nil
}
795183
func (e *SelectionExec) Close() error {
	e.childResult = nil
	e.selected = nil
	return e.baseExecutor.Close()
}