You said you were using it, right? The close button has a name, it's $parentClose, so it would be whatever you named your frame with Close at the end.
Lua Code:
local myDialogFrame = CreateFrame("frame", "myDialogName", UIParent, "UIPanelDialogTemplate")
myDialogNameClose:SetScript("OnClick", function()
-- whatever
end)