At this time of year I get quite a few butterflies in my office. They generally flutter about the room and then head back off to the window.
The common trait as they search for the open window (at the bottom) is they head up to the top panel of glass. They then come down, and then get stuck between the 2 panes of glass. Once they stop trying so hard and relax they fall through the very small gap between the two panes as this video shows.
Next time you're stuck in a situation it might be useful to consider there may be less obvious options available that require no effort at all.