This will still happen if your game cartridge isn't damaged. It's just a normal glitch on every gen V game. You don't usually loose data over it, it just says an error occurred and you turn in off and on again and it's fine.
I'm guessing you have turned it off by now. I've never heard of the glitch playing music and stuff if you remove the game cartridge. It's probably still fine.
Usually this glitch happens when you view some Pokémon data look on area go on fishing list and view another one and press b twice. So in future don't do this.