Added bash trap to output errors during the script execution and detect crashed jobs