You can make changes to when and how your laptop goes to Sleep or Hibernates by changing the power settings.
To change your power settings in Windows 7:
From here you can make changes to what the power button does and what closing the lip to your laptop will do.
To change your power settings in Windows 8:
From here you can make changes to what the power button does and what closing the lip to your laptop will do.