I'd suggest a method that is robust enough to handle if the user clicked the OK button on your message box without throwing an exception:
handleToMessageBox = msgbox('Please wait...');
if exist('handleToMessageBox', 'var')
Otherwise if the user clicked the OK button, as users tend to do, then when it hits your delete() function, the handle is already gone and it will throw an error (I tried it). My way avoids that error by not trying to delete the handle if it doesn't exist anymore.