【Apple Script 】Safari ブラウザの ウィンドウを全部閉じる

Safari ブラウザの ウィンドウを全部閉じる。

on closedAllWin(args)
    set {} to args & {}
    tell application "Safari"
        repeat with winIndex from 1 to (count of (every window))
            set win_id to (id of window winIndex)
            tell the window id win_id to close
        end repeat
    end tell
end closedAllWin