You need to put these window states into variables :
Boolean Window On Screen - YES/NO
Boolean Window Open - YES/NO
Boolean Window Close - YES/NO
Then like when you click on the instigator it will set one of those booleans to true or false
then you can put the window after doing a condition statement on the screen then turn it off when needed,etc
This will create a light switch-like window showing system hopefully.
Boolean is a technical term for a binary digit switch it works like this
True = some binary number
False = some binary number
Then in binary wrap those 2 binary numbers into a token like true or false also using binary :)