Many laptops employ a Hall Effect switch or some other magnetic sensor to detect the lid being open or closed. This acting on a sensor in the phone and causing it do what it's doing.
I've had the same thing happen when stacking 2 similar laptops on top of each other, one would ALWAYS turn the display off, I actually thought there was a problem with it.