@Override
    protected Product doInBackground(com.bc.ceres.core.ProgressMonitor pm) throws Exception {
      final TargetProductSelectorModel model = getTargetProductSelector().getModel();
      pm.beginTask("Writing...", model.isOpenInAppSelected() ? 100 : 95);
      ProgressMonitorList.instance().add(pm); // NESTMOD
      saveTime = 0L;
      Product product = null;
      try {
        // free cache	// NESTMOD
        JAI.getDefaultInstance().getTileCache().flush();
        System.gc();

        executeStartTime = Calendar.getInstance().getTime();
        long t0 = System.currentTimeMillis();
        Operator operator = null;
        if (targetProduct.getProductReader() instanceof OperatorProductReader) {
          final OperatorProductReader opReader =
              (OperatorProductReader) targetProduct.getProductReader();
          if (opReader.getOperatorContext().getOperator() instanceof Output) {
            operator = opReader.getOperatorContext().getOperator();
          }
        }
        if (operator == null) {
          WriteOp writeOp =
              new WriteOp(targetProduct, model.getProductFile(), model.getFormatName());
          writeOp.setDeleteOutputOnFailure(true);
          writeOp.setWriteEntireTileRows(true);
          writeOp.setClearCacheAfterRowWrite(false);
          operator = writeOp;
        }
        final OperatorExecutor executor = OperatorExecutor.create(operator);
        executor.execute(SubProgressMonitor.create(pm, 95));

        saveTime = System.currentTimeMillis() - t0;
        File targetFile = model.getProductFile();
        if (model.isOpenInAppSelected() && targetFile.exists()) {
          product = ProductIO.readProduct(targetFile);
          if (product == null) {
            product = targetProduct; // todo - check - this cannot be ok!!! (nf)
          }
          pm.worked(5);
        }
      } finally {
        // free cache
        JAI.getDefaultInstance().getTileCache().flush();
        System.gc();

        pm.done();
        ProgressMonitorList.instance().remove(pm); // NESTMOD
        if (product != targetProduct) {
          targetProduct.dispose();
        }
      }
      return product;
    }
    @Override
    protected void done() {
      final TargetProductSelectorModel model = getTargetProductSelector().getModel();
      try {
        final Date now = Calendar.getInstance().getTime();
        final long diff = (now.getTime() - executeStartTime.getTime()) / 1000;
        if (diff > 120) {
          final float minutes = diff / 60f;
          statusLabel.setText("Processing completed in " + minutes + " minutes");
        } else {
          statusLabel.setText("Processing completed in " + diff + " seconds");
        }

        final Product targetProduct = get();
        if (model.isOpenInAppSelected()) {
          appContext.getProductManager().addProduct(targetProduct);
          // showSaveAndOpenInAppInfo(saveTime);
        } else {
          // showSaveInfo(saveTime);
        }
      } catch (InterruptedException e) {
        // ignore
      } catch (ExecutionException e) {
        handleProcessingError(e.getCause());
      } catch (Throwable t) {
        handleProcessingError(t);
      }
    }