Unprotect $Path before changing its value

And Protect again after it is changed