Why You Should Always Switch Off Your Phone Before taking out The Battery
When you switched the phone off correctly, it knows that it power will be shut down shortly.
That means, all the applications and the operating system get the chance to save whatever needs to be saved and to go through their proper shut-down process.
Removing the battery without switching the phone off will immediately crash every running applications as well as the operating system(OS). It’s just like unplugging your system while it’s running. You can do it, but it’s not advice-able, a bad idea though.
Other thing is that While switching off your device, the operating system will make sure that every thing connected to the phone’s memory and external memory is properly and carefully closed.
If you remove the battery before switching off your phone, you may corrupt the memory which may lead to unexpected behavior.
To summarize everything, Please always switch off your phone before removing the battery.