Stories like this inspire me that not all new divers are badly trained factory divers. While there may have be suggestions on things that you could have done better, for a new diver, you kept your head and did well. Seriously, good on you, you did the most important things which were to remain calm, and survive. As they say - stop, breathe, think, act. You've learnt some lessons (that commercial anti-fog has some side effects, that good buddies are priceless, and equipment familiarity is a life saver)
As you become more experienced, you will also find that things like badly leaking masks will not stress you as much, and you will just deal with it as a matter of fact rather than a real "problem" . But that comes only with experience.
The only thing i'll mention, and only since nobody else has, is do you ahve any idea why your mask was leaking? Was it maybe catching on your hood? Or hair? or strap? Or was one of the edges bent over? I ask only as you need to learn to deal with normal issues such as these, fix them, and move on without removing the mask as your fix. With more dives, you should be able to remove your mask completely, remove any sealing obstacles (hair, hood etc) then put it back in with a proper seal.