A complicated script to automate functions in Safari
The following script works for me:

tell application "Safari"
    activate
    close every window
end tell

tell application "System Events"
    tell process "Safari"
        click menu item 6 of menu "safari" of menu bar item "Safari" of menu bar 1
        delay 0.5
        click button 2 of window 1
    end tell
end tell

tell application "Safari"
    make new document
    set the window_width to 1680
    set the window_height to 1575
    set the bounds of window 1 to {0, 22, window_width, 22 + window_height}
end tell