Closes the current connection.
Closes the current file writer.

@param line Command line
@param callback Callback for command status
14497
public void close(String line, DispatchCallback callback) {
    // close file writer
    if (sqlLine.getRecordOutputFile() != null) {
      // instead of line could be any string
      stopRecording(line, callback);
    }

    DatabaseConnection databaseConnection = sqlLine.getDatabaseConnection();
    if (databaseConnection == null) {
      callback.setToFailure();
      return;
    }

    try {
      Connection connection = databaseConnection.getConnection();
      if (connection != null && !connection.isClosed()) {
        sqlLine.info(
            sqlLine.loc("closing", connection.getClass().getName()));
        connection.close();
      } else {
        sqlLine.info(sqlLine.loc("already-closed"));
      }
    } catch (Exception e) {
      callback.setToFailure();
      sqlLine.error(e);
      return;
    }

    sqlLine.getDatabaseConnections().remove();
    callback.setToSuccess();
  }
319955
@Override
	public void close() throws Exception {
		try {
			if (outputStream != null) {
				outputStream.flush();
				outputStream.close();
			}

			// first regular attempt to cleanly close. Failing that will escalate
			if (client != null) {
				client.close();
			}
		}
		catch (Exception e) {
			throw new IOException("Error while closing connection that streams data back to client at "
					+ hostIp.toString() + ":" + port, e);
		}
		finally {
			// if we failed prior to closing the client, close it
			if (client != null) {
				try {
					client.close();
				}
				catch (Throwable t) {
					// best effort to close, we do not care about an exception here any more
				}
			}
		}
	}
1164460
@Override
  public void close() {
    try {
      if (this.isOpened() == true) {
        this.getTracePrintStream().println();
        this.getTracePrintStream().printf("--> TraceLog closing!%n");
        this.getTracePrintStream().printf("    Time     : %tc%n", new Date());

        System.out.println(formatStreamErrorState() + " Closing ...");

        this.getTracePrintStream().close();
        this.getBufferedOutputStream().close();
        this.fileOutputStream.close();
        this.setOpened(false);
      }
      else {
        System.err.println("WARNING: Tracelog is closed already.");
      }
    }
    catch (IOException ex) {
      ex.printStackTrace(System.err);
    }
  }
785830
@Override
    public void close() throws IOException
    {
        if (!_closed) {
            _closed = true;
            _nodeCursor = null;
            _currToken = null;
        }
    }
254005
static void closeLink(CommsConnection conn) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "closeLink", conn);

    conn.setSchemaSet(null);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "closeLink");
  }
1094811
@Override
  public void close() throws IOException {
    if (!closed) {
      objectOutputStream.close();
      fileOutputStream.close();
      closed = true;
    }
  }
1005957
public void close()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "close");

      // We should close the underlying connection at this point
      try
      {
         Conversation conv = getConversation();
         if (conv != null) conv.close();
      }
      catch (SIConnectionLostException e)
      {
         // Not a lot we can do here. So, debug the error and FFDC
         FFDCFilter.processException(e, CLASS_NAME + ".close",
                                     CommsConstants.CLIENTSIDECONNECTION_CONNECT_02, this);

         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Unable to close connection", e);
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "close");
   }
1121719
public void script(String line, DispatchCallback callback) {
    if (sqlLine.getScriptOutputFile() == null) {
      startScript(line, callback);
    } else {
      stopScript(line, callback);
    }
  }
877881
@Override
  public void close() throws IOException
  {
    SocketChannel s = _s;
    _s = null;
    
    if (s != null) {
      s.close();
    }

    /*
    OutputStream os = _os;
    _os = null;

    InputStream is = _is;
    _is = null;

    try {
      if (os != null)
        os.close();
      
      if (is != null)
        is.close();
    } finally {
      if (s != null)
        s.close();
    }
  */
  }
930787
@Override
    public void close() {
        if (!this.closed) {
            try {
                Future<String> closeTask = threadpool.submit(() -> {
                    commandWriter.println("exit");
                    p.waitFor();
                    return "OK";
                });
                if (!closeAndWait(closeTask) && this.pid > 0) {
                    //If it can be closed, force kill the process
                    Logger.getLogger(PowerShell.class.getName()).log(Level.INFO,
                            "Forcing PowerShell to close. PID: " + this.pid);
                    try {
                        Runtime.getRuntime().exec("taskkill.exe /PID " + pid + " /F /T");
                        this.closed = true;
                    } catch (IOException e) {
                        Logger.getLogger(PowerShell.class.getName()).log(Level.SEVERE,
                                "Unexpected error while killing powershell process", e);
                    }
                }
            } catch (InterruptedException | ExecutionException ex) {
                logger.log(Level.SEVERE,
                        "Unexpected error when when closing PowerShell", ex);
            } finally {
                commandWriter.close();
                try {
                    if (p.isAlive()) {
                        p.getInputStream().close();
                    }
                } catch (IOException ex) {
                    logger.log(Level.SEVERE,
                            "Unexpected error when when closing streams", ex);
                }
                if (this.threadpool != null) {
                    try {
                        this.threadpool.shutdownNow();
                        this.threadpool.awaitTermination(5, TimeUnit.SECONDS);
                    } catch (InterruptedException ex) {
                        logger.log(Level.SEVERE,
                                "Unexpected error when when shutting down thread pool", ex);
                    }

                }
                this.closed = true;
            }
        }
    }
233494
public void close() {
    try {
      if (conn != null) {
        conn.close();
      }
    } catch (IOException ignored) { }

    if (zkClient != null) {
      zkClient.stopAndWait();
    }
  }
1030697
public static void closeConnection(Connection connection)
        throws InternalErrorException {

        if (connection != null) {
            try {
                connection.close();
            } catch (SQLException e) {
                throw new InternalErrorException(e);
            }
        }

    }
262065
protected void closeConnection(ConnectionHandle connection) {
		if (connection != null) {
			try {
				connection.internalClose();
			} catch (Throwable t) {
				logger.error("Destroy connection exception", t);
			} finally {
				this.pool.postDestroyConnection(connection);
			}
		}
}
49923
@Override
    public void close() throws IOException {
        if (isClosed) {
            return;
        }
        flush(sendEor);
        if (sendClose) {
            eventPipeline.fire(new Close(), channel);
        }
        isClosed = true;
    }
570991
@Override
  public void close() throws IOException
  {
      if(this.in != null && this.inStream != null){
          if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
              logger.logp(Level.FINE, CLASS_NAME,"close", "close called->"+this);
          }
          this.in.close();
      }
      else{
          super.close();
      }
  }
179680
private void closeCurrent() throws IOException {
        virtualJarInputStream.closeEntry();
        currentEntry.crc = crc.getValue();
        crc.reset();
    }
1037775
public void close(final AVIMClientCallback callback) {
    final AVIMClientCallback internalCallback = new AVIMClientCallback() {
      @Override
      public void done(AVIMClient client, AVIMException e) {
        if (null == e) {
          AVIMClient.this.localClose();
        }
        if (null != callback) {
          callback.done(client, e);
        }
      }
    };
    InternalConfiguration.getOperationTube().closeClient(this.clientId, internalCallback);
  }