Dungeon of the Mad Mage (woof, that was a bad start to a game. I had to really bite my tongue when I was told that our agreeing to go down the well was a one-way trip. I didn't make a character who was suicidal enough to enter a death dungeon on a whim, with no way out.),
Jumped out at me. FWIW, that one's on your DM. As written, you can definitely leave the dungeon.