If the Switch's battery dies while you're playing, it will save all progress before shutting down.