Fix for script error on pressing a close button

that removes the button pressing it.
Merge pull request #363 from Person8880/develop

Fix for script error on pressing a close button