try
    screens = Screen('Screens');
    whichscreen = max(screens);
    [mainscreen, rect] = Screen('Openwindow', whichscreen);
    for i = 1:5
        SetMouse(rect(3)/2, rect(4)/2, mainscreen);
        WaitSecs(2);
    end
    Screen('CloseAll');
catch
    Screen('CloseAll')
    rethrow(lasterror)
end