private void waitForCommandFinished() {
      synchronized (callbackThread) {
        while (isCommandRunning) {
          try {
            callbackThread.wait();
          } catch (InterruptedException ignored) {
          }
        }
      }
      if (exitCode == ShellExitCode.WATCHDOG_EXIT || exitCode == ShellExitCode.SHELL_DIED) {
        close();
      }
    }
Check if the shell and callback thread have been closed.

@return {@code true} if the {@link Interactive} shell has been closed.
imitate/src/main/java/com/engineer/imitate/shell/Shell.java