Some of the waitress code has been overwritten to make this work (at `backend.db.ThreadedTaskDispatcher`). The `handler_thread` function has been changed so that when the thread shuts down, the database connection for the thread is also closed (this _has_ to happen _in the thread that the connection is for/from_). The `shutdown` function opens and closes a database connection at the end, which triggers the checkpoint of the journal, writing everything to the db file and removing the `-wal` and `-shm` temporary db files.