A few mornings ago my tablet was being temperamental and switching itself off. By the way I have an Asus Transformer TF101 which, I know, is old in technology age. If that wasn’t enough I kept getting the following error message when trying to recycle RAM: “Unfortunately, the process android.process.media has stopped.”
Take the SD card out. For some reason or another that also fixed the problem of the tablet switching itself off as well.
Factory reset the tablet. I’ve read that it helped others solved the issue but luckily, I didn’t have to (nor did I want to) take that measure.