Select Exit from the tray menu, which will cause KeyPass to write all database updates to disk before shutting down.