Maybe it was a bathroom break? They live in a shell man.
Seriously though, I have seen it before when mine molted. I thought something was wrong with it and then a couple of days later I found the empty shell. First time I had seen a molt and at first I thought the crab was dead until I saw it in the tank. I pulled out the empty and it looks as if they come out of the opening, or flap, that you are talking about. HTH