Good news, your code is fine and AppStudio is fine.
You may notice that when you deploy to the Desktop, the URL in the browser may look like this:
Then, when you close AppStudio and restart it to deploy to Desktop again, the URL port number has changed to something else, such as this:
This is normal, and is why your LS vars don't appear to be saved. They actually have persisted as they should, but over at the first URL, not this new one, which is essentially a new server address. You can enter the "old" URL and you'll see them there. You'll also get an AppStudio "Update Unsuccessful: cache error" message, but that's because of the way AppStudio interacts with the localhost.
All that to say, if you were to deploy to a real server made using a persistent URL, your LS vars will be retained.
I'll mention here, in case George is reading this, that there appears to be a false positive error in AppStudio's interpreter at line 10:
It returns "Bad Assignment" but runs fine and appears to be valid code. This has nothing to do with your question but may be something George would want to address.