try
    screens = Screen('Screens');
    whichscreen = max(screens);
    [myscreen,rect]=Screen('OpenWindow',whichscreen, [0, 255,0]);
    KbWait;
    screen('CloseAll');
catch
    screen('CloseAll')
    rethrow(lasterror)
end