Not sure about the ESC to close, but here's a tip to shorten the macro, which you started yet didn't finish.
Code:
/run LoadAddOn("Blizzard_AzeriteEssenceUI")
/run local b=AzeriteEssenceUI
/run b:ClearAllPoints()
/run b:SetPoint("CENTER")
/run if b:IsShown() then b:Hide() else b:Show() end