I know killing, polymorphing, or teleporting flytraps frees you, but i couldnt do any of those and wasnt able to kill it before i would die, so i tried escape via adjacent stairs, causing the softlock.