code: public void close() throws IOException {
      // if we haven't started the application, we have nothing to do
      if (isOk) {
        OutputCollector<K3, V3> nullCollector = new OutputCollector<K3, V3>() {
          public void collect(K3 key, 
                              V3 value) throws IOException {
            // NULL
          }
        };
        startApplication(nullCollector, Reporter.NULL);
      }
      try {
        if (isOk) {
          application.getDownlink().endOfInput();
        } else {
          // send the abort to the application and let it clean up
          application.getDownlink().abort();
        }
        LOG.info("waiting for finish");
        application.waitForFinish();
        LOG.info("got done");
      } catch (Throwable t) {
        application.abort(t);
      } finally {
        application.cleanup();
      }
    }
docs: Handle the end of the input by closing down the application.