def Close(self, PluginInfo):
        if self.Connection == None:
            cprint("Close: Connection already closed")
            return False
        if 'CommandsBeforeExit' in self.Options and self.Options['CommandsBeforeExit']:
            cprint("Running commands before closing Communication Channel..")
            self.RunCommandList(self.Options['CommandsBeforeExit'].split(self.Options['CommandsBeforeExitDelim']))
        #self.RunCommandList(self.Options['CommandsBeforeExit'].split('#'))
        cprint("Trying to close Communication Channel..")
        self.Run("exit")

        if 'ExitMethod' in self.Options and self.Options['ExitMethod'] == 'kill':
            self.Kill()
        else:  # By default wait
            self.Wait()
        #self.Read()
        #self.Connection = None
        #self.Connection.stdin = "exit\r"
        #self.Connection.wait()
        #self.Connection.kill()
        #return Core.PluginHelper.DrawCommandDump('Init Channel Command', 'Output', Core.Config.GetResources(Resource), PluginInfo, "") # No previous output
dataset/ETHPy150Open owtf/owtf/framework/shell/pexpect_shell.py/PExpectShell.Close/original