Do not try to finalize an sqlite statement not actually used.

Fix a segmentation violation.