I’m not offering a solution but advice on your script that, you never know, may have an outside chance of being the culprit (I doubt it, though).
Don’t nest application
tell blocks inside each other the way they are here. There are one or two boundary scenarios where one might wish to do this, and know how to do it, but generally speaking, there isn’t any reason for one application’s scripting dictionary to be open and accessed within the context of another’s.
Most of the time, you’ll appear to get away with it, because AppleScript is happy to throw silent errors in the background if it thinks it can resolve them itself. But it will impact script performance, and potentially create confusion if scripting terminologies have common terms, such as
position, that you might think is being applied to one application, but some other background error can send it up the nested app references until it gets used by another.
The script begins by telling Keynote to activate. Then for absolutely no reason whatsoever, calls System Events (inside the Keynote block, no less), and doesn’t ever have any commands intentionally issued to it.
The next line is another command to activate the application that was already activated, and to do it by opening another tell block inside itself.
Delete the first two tell enclosures: the first one to Keynote, and the one to System Events. Keep the innermost one only.
Remember to review your code as you go, and make sure you can explain to yourself why a particular line has to be inside any tell block. If you can’t, take it outside the tell block and see if it still works. If it doesn’t, you’ll learn the reason by the error generated, and that is helpful. If it does, then you just made your script a bit more efficient and you’ll get more used to being aware of what goes on in the background.
PS. Also, if you copy and paste your code rather than screenshot it, then others can actually get to try your code themselves and be more likely to find the problem for you. I can’t see anyone willing to type out verbatim the script from your screenshot, unless they are incredibly altruistic. Otherwise, I would have been happy to try and offer more helpful insight to remedy the issue.