you are probably using a trimmed rom, the pokemon games put the save in the rom file (not a seperate .sav file), if the rom is trimmed, there will be no 'save area' for the game to save to.
if your game is around 1.79gb / 1.80gb then it has been trimmed. The clean untrimmed rom should be exactly 2.00 gigabytes (which is 2147483648 bytes) in size.
If it is trimmed, you can use "3ds rom tool" to untrim the rom, use the command line: "rom_tool -r game.3ds" to untrim your rom.
you can find it here:
http://gbatemp.net/threads/3ds-rom-tool-rom_tool.349314/ once untrimmed then the save should stay when you exit and restart the game.
(there are probably other more user-friendly tools that can untrim a rom if you aren't familiar with command-line programs)