code: private void stop() {
          finish(inputThread);
  
          try {
              err.flush();
          } catch (IOException e) {
              // ignore
          }
          try {
              out.flush();
          } catch (IOException e) {
              // ignore
          }
          finish(outputThread);
          finish(errorThread);
      }
docs: Stop pumping the streams.