Database closing too soon

I have some issues with closing my database app AND ensuring that all the database operations have finished before closing the databases.

The app has several containers and modules with acces to a couple of databases and upon closing, they should save the data they are working on and some settings. However, even if the database-storing methods are called in the containers close event, it often reports a database error (database closed) upon closing the app.

So - basically my question is; How do I ensure all the operations are done before the app closes the database?

Mac OS, Xojo 2016 R3

local or remote databases?
my opinion is… if Local (on same computer/lan with one user)… keep the database open until the app closes
Remote… do not keep a persistent connection.

That being said… I’ll bet it is more likely the database is not OPEN when the transaction BEGINS… ie … you are closing BEFORE you start, not DURING the tranaction as you believe.

It’s a local database, so what you are saying is NOT to actively close the database before closing the app?!

[quote=321922:@Dave S]
That being said… I’ll bet it is more likely the database is not OPEN when the transaction BEGINS… ie … you are closing BEFORE you start, not DURING the tranaction as you believe.[/quote]

You’re absolutely right. The database is closed before the last transactions begin.