Make a button to open/close the VST window

What rank13 said!
And:
Have you named all your button widgets and plugin blocks corresponding to the names of the variables you are using in your script?
See above pictures and name each of the particular elements accordingly.
You also should propably better use “speaking” names for your buttons and pluginblocks (and the corresponding variables in the script). “Button1” or “Plugin1” is quite abstract.