Fixing exit code handling

The endlocal statement will wipe out the ERROR_CODE variable, so we cannot access %ERROR_CODE% after endlocal.
Merge pull request #65 from jasonmray/master

Fixing exit code handling