tools: bugfix: add missing close after failure

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Id873c41997e2617d1fa3db5767112c23d77c487c
diff --git a/tools/handler.cpp b/tools/handler.cpp
index 25bb48d..147a457 100644
--- a/tools/handler.cpp
+++ b/tools/handler.cpp
@@ -130,6 +130,7 @@
     }
     catch (const ipmiblob::BlobException& b)
     {
+        blob->closeBlob(session);
         throw ToolException("blob exception received: " +
                             std::string(b.what()));
     }
@@ -164,14 +165,23 @@
         session =
             blob->openBlob(ipmi_flash::cleanupBlobId,
                            static_cast<std::uint16_t>(blobs::OpenFlags::write));
+    }
+    catch (...)
+    {
+        return;
+    }
+
+    try
+    {
         std::fprintf(stderr, "Committing to the cleanup blob\n");
         blob->commit(session, {});
         std::fprintf(stderr, "Closing cleanup blob\n");
-        blob->closeBlob(session);
     }
     catch (...)
     {
     }
+
+    blob->closeBlob(session);
 }
 
 } // namespace host_tool