Close the database

When I try the viewing the crimeBase.db file with a simple cat command, it’s always empty. If I copy that file along with crimeBase.db-shm and crimeBase.db-wal to my PC, then I can view it with sqlite3. Upon exiting sqlite3, the temporary files disappear and then I can view crimeBase.db with cat.

I think this might be happening because the database connection is never closed in the app. Where should this happen?