diff --git a/source/common/widgets/widgetresourcedata.cpp b/source/common/widgets/widgetresourcedata.cpp
index 84822fc86..fd416e1d1 100644
--- a/source/common/widgets/widgetresourcedata.cpp
+++ b/source/common/widgets/widgetresourcedata.cpp
@@ -12,6 +12,11 @@ void InitWidgetResources(const char* filename)
 		I_FatalError("Unable to open %s", filename);
 }
 
+void CloseWidgetResources()
+{
+	if (WidgetResources) delete WidgetResources;
+}
+
 static std::vector<uint8_t> LoadFile(const std::string& name)
 {
 	auto lump = WidgetResources->FindEntry(name.c_str());
diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp
index 7357eb934..21fa5df7e 100644
--- a/source/core/gamecontrol.cpp
+++ b/source/core/gamecontrol.cpp
@@ -90,6 +90,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 void LoadHexFont(const char* filename);
 void InitWidgetResources(const char* basewad);
+void CloseWidgetResources();
 
 CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
 CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@@ -663,6 +664,7 @@ int GameMain()
 		gi = nullptr;
 	}
 	DeleteStartupScreen();
+	CloseWidgetResources();
 	PClass::StaticShutdown();
 	C_UninitCVars();
 	if (Args) delete Args;