Try a fix because sometimes job goes in terminated mode without being finished, due to jobstate error -> return 5=finished. Add a retry