code: public void close() {
        cancel = true;
        try {
           thread.interrupt();
           waitFor();
        } catch (Throwable ignore) {}
  
        try {
           is.close();
        } catch (Exception ignore) {}
  
        try {
           os.close();
        } catch (Exception ignore) {}
     }
docs: Interrupts the gobbler and closes its streams.