It's because you've still got an extra "Quit Front Application" action in there, which will always execute regardless of what's gone on earlier. It's easier to see if we close some actions down:
And if you follow the "flow" on that it is
if Local_time is less than 500 then
execute the AppleScript and either Quit Safari or Cancel the Quit
(and after the AppleScript has finished, regardless of the button clicked...)
Quit Safari
otherwise
Cancel this Macro
end if
It's worse than it looks -- if you do Quit Safari in response to the AppleScript, there's a high chance you then Quit another application as well because that's now your current "front application".
Also, you don't need the "Cancel This Macro" at the end -- just let the macro complete "normally". Save "Cancel" for when you explicitly need it and you'll save yourself a lot of head-scratching later -- imagine if you went to add some actions to the end of that macro but the action containing the "Cancel" was closed:
It could take a while to work out why your addition wasn't doing anything!