finalize query_tree_emit() transactions handling