diff --git a/tsg_util/quitProgram.m b/tsg_util/quitProgram.m
index 85134f1035a697ed5f304404c9bc31dee66daf86..60b989a9c78fd08dd460595231df5ba226512d06 100644
--- a/tsg_util/quitProgram.m
+++ b/tsg_util/quitProgram.m
@@ -11,8 +11,8 @@ function quitProgram(DEFAULT_PATH_FILE, varargin)
 
 % $Id$
 
-% close windows
-% -------------
+% close all windows
+% -----------------
 for i=1:size(varargin,2)
   delete(varargin{i});
 end
@@ -31,4 +31,9 @@ rmpath( [DEFAULT_PATH_FILE filesep 'tsg_io'] );
 % --------------------------
 rehash;
 
+% clear base workspace just before quit, this is the only method
+% to clear NetCDF variables assign to base workspace with assignin
+% ----------------------------------------------------------------
+evalin('base','clear all');
+
 end
\ No newline at end of file
diff --git a/tsgqc.m b/tsgqc.m
index 6fc504b82926e6aadfcf8ae216dd856ff4b3e831..aee96d868f2d2bf539cfe112e170bf6da99d904d 100644
--- a/tsgqc.m
+++ b/tsgqc.m
@@ -131,6 +131,7 @@ hMainFig = figure(...
    --------------------------------------
   'CloseRequestFcn', @QuitMenuCallback,...
   %}
+  'CloseRequestFcn', @QuitMenuCallback,...
   'HandleVisibility', handleVisibility,...
   'Visible','on',...
   'Tag','TAG_TSG-QC_GUI',...