XDesktop desktop = UnoRuntime.queryInterface(
XDesktop.class,
factory.createInstance("com.sun.star.frame.Desktop"));
factory = null;
try {
desktopTerminated = desktop.terminate();
} catch (DisposedException e) {}
// it appears that DisposedExceptions can already happen while
// receiving the response of the terminate call
desktop = null;
} else if (process != null) {