In this particular case, we really don't care what happens to the database when after the app is finished. So I think we can just simply not to close the db.
afaik[1] the important issue is to finish the transactions correctly.

[1] http://stackoverflow.com/questions/9561832/what-if-i-dont-close-the-database-connection-in-python-sqlite