could you please specify which platform you are on. It looks like you are using CMD files so I presume that you are on Windows using CMD scripts. It may be relevent to mention the exact version of the OS that you are using.
Does your approach of catching return codes
IF ERRORLEVEL 1 EXIT /B 1
work in other scripts?
I would write a little example and verify that catching the ERRORLEVEL on your machine works as expected.
If we can get a little more detail, I will tweet this question out and get more of our esteemed CM gurus to comment!