Close all prepared queries before closing the database.