Build script enhanced error handling.
Add dedicated cleanup function.