If you attempt to access the data from the On exit database method, your 4D Client Application will freeze. This is due to the fact that the "quitting" process is a local process and it cannot access data. The proper way to implement such a feature is to launch a new process from the On Exit database method and, while pausing the exit process, access the data. Once the process accessing the data is done performing its tasks, resume the execution of the exit process (such a system can be implemented using interprocess variables).
For more information see:
Commands and Topics for Database Methods