Mid-2015 MacBook Pro shuts off without warning when an Ethernet adapter is *not* plugged into a Thunderbolt port. Why?
There is a nice thread about it here: https://de.ifixit.com/Antworten/Ansehen/320496/Randomly+shuts+down+when+not+connected+to+an+external+display.

Turns out there maybe a few reasons why this happens:


Thermal paste
Thunderbolt-Ethernet-Driver
Magnetic sensor that indicates when lid is closed is damaged.


This is definitely a thread you want to read, several very useful info there.

I've been having this problem my self, right now testing your fix, having just an ethernet dongle connected.

Good luck