Hello!
This gui-click-handler will destroy any mod's GUI that might have a button named "close". I ran into this where a GUI of mine got corrupted when someone clicked on a button named "close".
I would suggest changing it to:
local function onGuiClick(event)
if event.element.name == "close" then
local parent = event.element.parent
if parent and parent.name == "EMC_frame" then
parent.destroy()
end
end
end