Will a 3ds be fine if a cartridge is removed while it is running?
As long as you weren't in the middle of saving when the incident occurred, you'll be fine. The only problem with removing the cartridge while the system/game is on is the game will no longer play(until you put the cart back in and restart the system), and any unsaved progress will likely be lost.
If you remove the cartridge/power off the system while it is saving, there is a chance your save data could get corrupted and you would be forced to start over (varies from game to game)
Your 3DS will be fine. I've taken my game out of my cartridge many times while it was running and I've had no problems.