My 15-inch 2016 MacBook Pro is now experiencing shutdowns when the lid is closed. Though it is not a crash because I don't get a crash report when I turn the computer back on (unlike the problem I had earlier). I used the following Terminal command to obtain the Previous Shutdown Cause (as the console app can't do it anymore in Sierra):
log show --style syslog --last 48h | egrep shutdown\ cause | awk -F')' '{print substr($0,1,19), $NF}'
The code for the shutdown is 0. From this question I found that 0 triggers when you unplugged the battery, or the power cable on desktop Macs. But the battery on the 2016 MacBook Pro is non-removable (obviously). Even more strangely, when this happens, my laptop is plugged into the power adapter and for sure it is charging. This doesn't happen when I am using the computer both on battery and power adapter, it only happens when the lid is closed for a while.
I have tried to reset SMC and NVRAM with no luck. Anyone know how to solve this problem?