function [] = quit()
%QUIT Closes all windows, cleans up workspace and quits ARTOA4.

global artoaGui;

openedFigures = fieldnames(artoaGui.figures);
for i = 1:length(openedFigures)
    current = openedFigures{i};
    if strcmp(current, 'main')
        continue;
    end
    delete(artoaGui.figures.(current).Number);
end

% Close main figure
delete(artoaGui.figures.main.Number);

clearvars -global artoaGui artoaDataInput artoaDataOutput artoaWorkspace;

end

