I tried some code for my close button, and it had minor glitches on studio but shut down the game on roblox???
button = script.Parent.Parent.Parent
window = button.Parent.Parent.Parent
function onClicked(GUI)
window:remove()
end
script.Parent.MouseButton1Click:connect(onClicked)

2 comments
Please send a screenshot of where your script is, and where your GUI's are and stuff. Kind of hard to see what we're working with.
Get rid of your word "Gui", I believe it has no parameters (the MouseButton1Down event, why are you using MouseButton1Click?) -- switch remove with destroy.