SetPreferences: Open MetaDataUpdate in try-with-resource

Change-Id: I2ca5fd003068cf3506dc0b0b33f1eb8dca165c26
diff --git a/src/main/java/com/googlesource/gerrit/plugins/labelui/SetPreferences.java b/src/main/java/com/googlesource/gerrit/plugins/labelui/SetPreferences.java
index ca53199..ddc76d8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/labelui/SetPreferences.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/labelui/SetPreferences.java
@@ -77,8 +77,7 @@
 
     VersionedAccountPreferences p =
         VersionedAccountPreferences.forUser(rsrc.getUser().getAccountId());
-    MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName);
-    try {
+    try (MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName)) {
       p.load(md);
 
       if (input.ui != LabelUi.DEFAULT) {
@@ -88,8 +87,6 @@
       }
 
       p.commit(md);
-    } finally {
-      md.close();
     }
 
     PreferencesInfo info = new PreferencesInfo();