Sources of shutdown error
Login Items
go to apple > System Preferences Users & Groups, then login items. Remove any apps here to see if it cures the shutdown issues. Start up apps are also in LaunchAgents, LaunchDaemons and Startup-items in the ~/Library and/Library folders.
Check for extensions
go to apple > System Preferences > Extensions. Another potential cause of shutdown issues is bugs and faults in MacOS extensions. Check here to see what extra items have been added. They may be the cause of shutdown problems, so remove them.
Find the cause
Finding the cause of shutdown problems is the best way to solve them. Start the Mac, log in, wait a minute or two and shutdown. if there are problems then the cause is something loading at login. if it's okay, run an app, then shut down. You may be able to narrow down the cause to a single app.