csync_statedb: Finalize the precompiled statements after discovery.

As described in http://www.sqlite.org/cvstrac/wiki?p=MultiThreading precompiled
statements should not be used across thread borders. However, the reconcile
phase would reuse the statements if defined (it calls statedb function from
a different thread) so it is saver to finalize them at the end of the
update run.