Your AppleScript action works fine for me.
But Safari sometimes can have some invisible documents/windows. Maybe it is related to that.
Have you tried to restart Safari?
Here a couple of variants from another thread. They are all working fine for me[1]:
___ [test] Safari URL.kmmacros (3.5 KB)
[1] Safari 10.1.1, macOS 10.12.5