Just as the title says
instead of just pressing M to exit the Map on Dungeons
Suggestion is Esc / M exit map view