              logger.debug("Sending Exit Signal")
              print("Sending Exit Signal", flush=True)
              try:
                  now = time()
                  if os.name == "nt":
                      try:
                          logger.debug("Sending carriage return to process")
                          self.process.communicate(input="\n", timeout=60)
                      except TimeoutExpired:
                          raise ValueError("Timeout reached sending Exit Signal")
                  else:
                      logger.debug("Sending SIGINT to process")
                      self.process.send_signal(signal.SIGINT)
                      while True:
                          timeelapsed = time() - now
                          if self.process.poll() is not None:
                              break
                          if timeelapsed > 60:
                              raise ValueError("Timeout reached sending Exit Signal")
                  return
              except ValueError as err:
                  logger.error("Error terminating process", exc_info=True)
                  print(err)
          else:
 
</s> remove             try:
 </s> add             if os.name == "nt":
                try:
                    logger.debug("Sending carriage return to process")
                    self.process.communicate(input="\n", timeout=timeout)
                except TimeoutExpired:
                    logger.error("Timeout reached sending Exit Signal")
                    self.terminate_all_children()
            else:
                logger.debug("Sending SIGINT to process") </s> remove             except ValueError as err:
                logger.error("Error terminating process", exc_info=True)
                print(err)
 </s> add  </s> remove             logger.debug("Terminating Process...")
            print("Terminating Process...")
            children = psutil.Process().children(recursive=True)
            for child in children:
                child.terminate()
            _, alive = psutil.wait_procs(children, timeout=10)
            if not alive:
                logger.debug("Terminated")
                print("Terminated")
                return
 </s> add             self.terminate_all_children() </s> remove                     else:
                        continue
 </s> add                     continue
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
              logger.debug("Sending Exit Signal")
              print("Sending Exit Signal", flush=True)
              try:
                  now = time()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                self.process.send_signal(signal.SIGINT)
                while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > timeout:
                        logger.error("Timeout reached sending Exit Signal")
                        self.terminate_all_children()
                  return
              except ValueError as err:
                  logger.error("Error terminating process", exc_info=True)
                  print(err)
          else:
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Add timeout slider to train tab. Terminate properly on timeout 
lib/gui/wrapper.py