I don’t know what’s going on, but the things I would try would include:
Watch the Engine.log file to see what macros are triggered when (tail -f ~/Library/Logs/‘Keyboard Maestro’/Engine.log in the Terminal may be useful, or you can open the Engine.log file in the Console app). You might like to add Log actions in various places to see what exactly Keyboard Maestro is executing when.
Start Debugging (Status Menu ➤ Start Debugging) and see if the macros are actually finishing or if the macro is stuck part way through. You may find that the Execute Script action is waiting for all its children to die before finishing, in which case even though you backgrounded the caffinate command, its still waiting on it to complete. You can resolve this by piping away all the output of the command with this loveliness:
(caffinate -dis 2>&1 >/dev/null) 2>&1 >/dev/null &