If you die in a dungeon in co-op or single player, do you still get to keep the loot that you have gathered?

For example, if you unlock a bunch of chests and pick up coins, pass a dungeon and then click contine, if I die in the next dungeon after opening up maybe 2 chests, does that mean I still get those 2 chests as loot even though I have died?