I softlocked myself in this part of the level; whenever I try to get the apple after pressing the button, the gate always closes on me. Can you please add a reset button to the game to avoid scenarios like this in the future?

Good thinking! I usually have a reset button in most of my games (R by default) but for this one I intentionally didn't code it in because the player is never meant to get stuck, just persevere until a solution is found :) (although I'm sure some speedrunner will eventually figure out a way to softlock themself that I didn't anticipate X) )
Hope you'll get through it!