Fix bug DNN-3133: move the delete portal setting into try catch, so that if there is exception throw out, the flag will not removed and job can run again next time.