On the Home Button menu, pressing/tapping the "Close Software" button counts as an L button press that triggers before closing the software.
I found this when testing a game that allows you to change the music by pressing L/R (SuDokuL). Every time I closed the game using this specific method, I found that starting the game again would start at the previous song index. I disabled the L button by commenting out the if (event.cbutton.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) check, and that fixed it.