What AS version are you on?
That looks similar to comments at the end of if-else control flow
And also CLI scripts: flow control and commands vs operations - Red Hat Customer Portal which references [WFLY-3662] CLI: non-batchable commands appearing in control flow statements executed regardless of condition - JBoss Is…
For older AS/WildFly versions the if/else statement had some issues, but it looks that should be resolved with WildFly 9/10.
I am using WildFly 10.0 along with Teiid 9.2.2.
Please try the WildFly forum as well then, as it looks like that should work from WFLY-3662