Always check if the db is already closed to avoid errors on shutdown.
Commit and compact the database on startup.
Serialize the message outside of the synchronized block.
Rename config variables and compact on a regular basis.

Database commits get slow once the database gets big.
Update to MapDB 1.0.5.

Fixes some transaction log problems.