Set handler state to terminated before exiting. Also simplify scratch handler exit loop. Change-Id: I0a80c8a1899e8b60a6e7aa6989ba28de42ba31e7 [ROCm/ROCR-Runtime commit: e06dd39d89]
e06dd39d89