outW = null; resetWriter(); setWriteMode(CANCEL);
  public void writeBatch() throws IOException {        if(getInstances() == null)          throw new IOException("No instances to save");      if(getRetrieval() == INCREMENTAL)          throw new IOException("Batch and incremental saving cannot be mixed.");      setRetrieval(BATCH);      setWriteMode(WRITE);      if(retrieveFile() == null || getWriter() == null){          System.out.println((getInstances()).toString());          setWriteMode(WAIT);          return;      }      PrintWriter outW = new PrintWriter(getWriter());      outW.print((getInstances()).toString());      outW.flush();      outW.close();      setWriteMode(WAIT);  }