After I collected the hardest triangle third and the highest triangle last, the gate hadn't opened because it didn't register the hardest triangle. I decided to check up on the chest in the dark room again, and sure enough, it was closed again, even though I knew for sure I had collected it. I went back to the last gate and this time, all but the highest triangle were there. I had to go back for that one as well before I could finally complete the game. Needless to say, I cried.
;)