%% close_fig
%    callback function that is called whenever the close button is
%    pressed.
% inputs:
%   object - current GUI object
%   src - source of the callback calling
%   event - event that triggered the callback
% outputs:
%   none
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function [] = close_fig(object,src,event)
if (object.validation_report_handle ~= 0)
    delete(object.validation_report_handle);
    object.validation_report_handle = 0;
end
object.save_data;
object.data.open = 0;
object.data.fig = [];
delete(object.fig);
% remove reference to the old figure.
object.fig = [];
% in simulink mode
if(object.mode == 1)
    parent = get_param(object.block_handle,'Parent');
    open_system(parent);
end
end

