My solution: write this in the second function written by guide (my_gui_OpeningFcn):
set(handles.figure1,'CloseRequestFcn',@closeGUI;
Then write an extra function like this:
function closeGUI(hObject, eventdata, handles)
selection = questdlg(Close MyGUI?', ...
'Warning', ...
'Yes','No','Yes');
switch selection
case 'Yes'
delete(gcf)
case 'No'
return
end