if exist('chlfig','var')
   
   try
      close(chlfig);
   catch
      fprintf('');
   end;
   
   
end;

if exist('lwnfig','var')
   
   try
      close(lwnfig);
   catch
      fprintf('');
   end;
   
   
end;

%close any K figures(Kfigure K handle)
if exist('Kfigure','var')
   
   try
      close(Kfigure);
   catch
      fprintf('');
   end;
   
   
end;

%close any Lw figures(lwfigure lw handle)
if exist('lwfigure','var')
   
   try
      close(lwfigure);
   catch
      fprintf('');
   end;
   
   
end;

close(fig);
graphcon;