Move sqlite finalize to correct memory leak.