My kid could've died due to my negligence

I was cooking dinner for myself and my toddler, let the oil get too hot and it got smoky so I turned the fans on and opened a couple of windows. I opened a window that my toddler could reach. We live on an upper floor. WHAT THE FUCK WAS I THINKING?! I wasn't. I reached the baby gate at the kitchen "oh SHIT" I turned around and my kid is pushing the screen off of the window. I don't think I've ever ran so fast in my life. I want to throw up. It's been a few hours and I can't stop thinking about grabbing my toddler's leg, other half already pushing to get out of the window. I can't believe I was so stupid and careless. How do I tell my partner I almost let our child die and expect to be trusted ever again?! I'm sitting on the floor with my head in my hands and this sweet little ball of energy comes up and asks "you 'kay?" Gives me a hug and says "I gotsh you" I just. Can't even think right now. I just can't believe how close I was to losing my child.

EDIT: Thank you all for your kind comments, stories and insights. I've been reading all of the comments so far but not responding and instead playing with, cuddling, eating popsicles with my kiddo, and just being grateful that I reacted in time before disaster struck. I've gained my bearings a bit now, I will be talking to my partner about what happened and implementing (even MORE) kid proofing to our home. Hug your kiddos tight and stay vigilant everyone