No, you do not need to gather all items or defeat all enemies to exit the mine. Once you have unlocked the elevator and made your way to the top, you can exit the mine regardless of any remaining enemies or items.