I hope there's an else somewhere in that script... But other than that, adopt better programming conventions and use a float (like 1=open, 0=closed). Nobody uses strings to check for such things. That should sort your problem without the need of even explaining what's wrong with your current one.
And rotate sets new absolute angles. JA doesn't unfortunately recognize relative rotation.
Frozen by ICARUS