Manually clicking on the spotlight icon once brings up the Spotlight search bar. Manually clicking the spotlight icon again dismisses the search bar. Amazing.
I have a macro set to "move and click" the Spotlight icon then "just move" to the center of the screen.
When running the same macro a second time, it does not dismiss the Spotlight search bar. The mouse movement is working correctly but doesn't seem to be clicking (or being affected by the click).
Neither setting action delays (between actions) or manual pauses between actions for any length of time help.
I've also tried "clicking found image" of the Spotlight icon and this does not dismiss Spotlight either.
As for why I want this to work, I use Command+Space to record in Pro Tools. In every other application, I want Command+Space to activate spotlight.
Perhaps you haven't considered the KM feature that allows keyboard shortcuts to be application specific. You set this within the Group where your macro is stored. There's an option that defaults with the setting "Available in all applications". If you use this setting, I think you can get CMD+SPACE to mean one thing in Pro Tools (ie, activate that shortcut) while it would use its default value for the rest of macOS, including all the other applications.
And even if you don't like that solution, how about this: change the default keystroke for Spotlight in System Preferences / Keyboard / Shortcuts to some other value, and use KM to remap CMD+SPACE to the new value for all other apps. That way you don't have to deal with the mouse.
However I must admit I'm not sure where you are defining CMD+SPACE to work in Pro Tools. If you are using a mechanism inside Pro Tools to do that, my advice might be inaccurate.