I would suggest trying to go back to El Capitan and try this program.
[https://gfx.io/]
It disables the more powerful GPU, which is known to fail on many MacBooks and cause shutdown issues.
When you get it, only run in on the I for the integrated GPU. If it still crashes there are other issues, but this is the easiest and cheapest thing to try first.
Report back with your results!