Fixed two minor bugs that relate to rolling back transactions upon errors.

* Changed the transaction begin statement to the beginning of the metadata sync function. This way, we won't have duplicate shard placements in system catalogs if a previous run errored out.
* In the metadata synchronization function, we now catch the SQLException and explicitly rollback the transaction before we close the connection.

CR: ozgune