it happens because there a sensor that can detects magnets, so your phone might have something that causing the sensor to think the phone is a magnet. it tell the computer if the screen is closed or not. you can grab a magnet and move it around you should see your screen turn off and on.