Hey, I have the same exact problem. I can't tell you how to fix the sleep problemm (haven't quite found the solution myself) but I can tell you how can you stop your laptop automatically going to sleep so you don't lose your work. Go to control paanel > mobile pc > change battery settings. Now choose your power plan (i.e if you're using HP recommended), click on change plan settings. Now, on the options for Put computer to sleep, choose never, both while plugged as on battery. This way you're computer won't automatically go to sleep once you close the lid.