// grab the graphics context so cleanup will work out.
final CanvasRenderer cr = canvas.getCanvasRenderer();
cr.makeCurrentContext();
ContextGarbageCollector.doFinalCleanup(cr.getRenderer());
canvas.close();
cr.releaseCurrentContext();
System.exit(0);
} catch (final Throwable t) {
System.err.println("Throwable caught in MainThread - exiting");
t.printStackTrace(System.err);