NXP-12517: Exit build and test script with correct error code