SQLite3 Cleanup fixups

This fixes a crash you probably get on shutdown after disposing the SQLite3 cache. Note that you *must* clean up all `sqlite3_stmts` before you call `close` or else you get a bizarre "out of memory" error message (aka "the message is null, guess it must have been an allocation error")