If your Windows 11/10 PC shuts down while installing or uninstalling a program, you need to follow the solutions mentioned in ...
If you have an old RAM ... a restart is pending for installing Windows Update, and it is already scheduled, your PC might not take permission to shut it down even when you play games.