Macs automatically go to sleep when you close the lid (unless attached to an external monitor and plugged in).
Just go download NoSleep.
http://www.macupdate.com/app/mac/37991/nosleep
It allows you to turn an option on and off that allows you to close the lid of your Mac, but not automatically put itself to sleep. I've used it for years. I do a lot of DVD ripping on my Macbook Air, but my little one likes to play with the keyboard when the lid is open. Perfect solution.
----------
See my post above for a work around. Easy Peasy