Fix shutdown handling of sqlite3 astdb.