UnloadUserprofile displays the error "The handle is invalid" the second time it is called. The script in attachment gives reproduction steps. The issue have been found on Windows 2008r2, windows 2012r2. It exists with python 2.7 and python 3.7. (script done for 2.7)