--- a/chrome/browser/ui/tabs/tab_strip_model.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -12,6 +12,7 @@
 #include <unordered_map>
 #include <utility>
 
+#include "base/command_line.h"
 #include "base/containers/adapters.h"
 #include "base/containers/contains.h"
 #include "base/containers/flat_map.h"
@@ -2224,6 +2225,10 @@ void TabStripModel::CloseTabs(base::span
     return;
   }
 
+  const std::string flag_value = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("close-window-with-last-tab");
+  if (flag_value == "never" && !closing_all_ && static_cast<int>(filtered_items.size()) == count())
+    delegate()->AddTabAt(GURL(), -1, true);
+
   const bool closing_all = static_cast<int>(filtered_items.size()) == count();
   base::WeakPtr<TabStripModel> ref = weak_factory_.GetWeakPtr();
   if (closing_all) {
--- a/chrome/browser/ungoogled_flag_choices.h
+++ b/chrome/browser/ungoogled_flag_choices.h
@@ -55,4 +55,10 @@ const FeatureEntry::Choice kOmniboxAutoc
      "omnibox-autocomplete-filtering",
      "search-bookmarks-chrome"},
 };
+const FeatureEntry::Choice kCloseWindowWithLastTab[] = {
+    {flags_ui::kGenericExperimentChoiceDefault, "", ""},
+    {"Never",
+     "close-window-with-last-tab",
+     "never"},
+};
 #endif  // CHROME_BROWSER_UNGOOGLED_FLAG_CHOICES_H_
--- a/chrome/browser/ungoogled_flag_entries.h
+++ b/chrome/browser/ungoogled_flag_entries.h
@@ -44,4 +44,8 @@
      "Omnibox Autocomplete Filtering",
      "Restrict omnibox autocomplete results to a combination of search suggestions (if enabled), bookmarks, and internal chrome pages. ungoogled-chromium flag.",
      kOsAll, MULTI_VALUE_TYPE(kOmniboxAutocompleteFiltering)},
+    {"close-window-with-last-tab",
+     "Close window with last tab",
+     "Determines whether a window should close once the last tab is closed. ungoogled-chromium flag.",
+     kOsDesktop, MULTI_VALUE_TYPE(kCloseWindowWithLastTab)},
 #endif  // CHROME_BROWSER_UNGOOGLED_FLAG_ENTRIES_H_
