Automatically defrag the database on close.
Add Version class, and use it for storing the version.