diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp
index 41b899d98e0f7a..e9ea6f9a3e46ef 100644
--- a/examples/chip-tool/commands/common/CHIPCommand.cpp
+++ b/examples/chip-tool/commands/common/CHIPCommand.cpp
@@ -165,16 +165,9 @@ void CHIPCommand::MaybeTearDownStack()
     // since the CHIP thread and event queue have been stopped, preventing any thread
     // races.
     //
-    ShutdownCommissioner(kIdentityNull);
-    ShutdownCommissioner(kIdentityAlpha);
-    ShutdownCommissioner(kIdentityBeta);
-    ShutdownCommissioner(kIdentityGamma);
-
-    std::string name        = GetIdentity();
-    chip::FabricId fabricId = strtoull(name.c_str(), nullptr, 0);
-    if (fabricId >= kIdentityOtherFabricId)
+    for (auto it = mCommissioners.begin(); it != mCommissioners.end(); it++)
     {
-        ShutdownCommissioner(name);
+        ShutdownCommissioner(it->first);
     }
 
     StopTracing();