Remove some more calls to the deprecated Transaction#finish().

These are more conversions of try/finally into try-with-resources.