Implement Autosaving feature
Make a checkbox. if it's checked enable periodic saving in the Data folder periodically.
The filename should be
OLD_FILENAME-timestamp.xml
Use
saveDocumentAs(URL url)