How to prevent an applet from being silently closed (with unsaved data)