If you decide to exit the map, you have to open the Menu option in the upper right side of the screen and select "Abandon Quest". Alternately, if you select "Give Up" from the menu during a battle, you'll leave both the battle and the current quest. Abandoning the quest or giving up will make you lose all collected items. Earned EXP however, will be retained.
In case your party's HP is depleted, this will result in a "Game Over". You'll be prompted to use a Dragon Stone if you want to continue the battle. As I emphasized a lot of times before, Dragon Stones are extremely valuable. Avoid using them to continue a battle where you lost the first time around. Besides, Stamina can be restored easily. Dragon Stones are not. Not continuing from a Game Over screen will still make you lose your collected items but you'll still retain your earned EXP.