Looks like it bugs out because of soul swap not triggering gcd.
This should work as intended: (I added reset after combat or after 10 sec)
Code:
/castsequence reset=combat/10 Curse of the Elements, Soulburn, Haunt
/cast Soul Swap
And btw. if it is your pull rotation, you should precast Haunt before it lands (0 sec of pull timer) you apply curse of the elements and soul burn - demonsoul - soul swap and instantly spam malefic grasp (to 10 stacks of agony ASAP)
But as I always say don't get used to castsequence macros, this can be easily done with separate key bindings.
Castsequence macros may not give the result you want. If you spam the macro above while you are in the gcd you will cast soulburn but not soul swap, I really recommend you to do it by yourself, but this is your decision.