If it was in fact on, then that's a fatal error. If the lid was closed, the screen should not have been on. So your laptop could potentially have been awake throughout the entire night. If you then have uTorrent installed and running for example, it can prevent your computer (this can be changed in settings) from going back to sleep. I know that Acronis True Image for example is able to wake up my computer even when asleep (I can set that up in settings) to back up my data. As others have stated, modern laptops are able to wake up on their own to apply updates, or to run a pre-set automation process. As to why that happened, I would say it's probably because of overheating and bad quality components.