function quitProgram(DEFAULT_PATH_FILE, varargin)
% QUITPROGRAM Exit tsgqc_GUI application
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
%
% Output
% ------
% none

% $Id$

% close all windows
% -----------------
for i=1:size(varargin,2)
  delete(varargin{i});
end

% reset userdata property of root Matalab object (0) for next use
% ---------------------------------------------------------------
set(0, 'userdata', []);

% reset Matlab search path to default
% -----------------------------------
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_util'] );
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_data'] );
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_io'] );

% Refresh file system caches
% --------------------------
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