Laptop turning off due to positioning relative to another one
Magnets.

Sensors in the body of the awake MBP are detecting magnets in the lid of the closed MBP.  It thinks you've closed the lid, so it goes to sleep.