Added cleaner exit code to master.py