Might as well move that to an answer:
Warning: Most laptops, but macs especially, draw air through the keyboard and spit it out the vents (in macs that is between the screen hinge and the lower base). So closing the lid and leaving it running is going to decrease airflow, read: increase heat. While I discourage you leaving your laptop closed and running software, this can be done.
Easiest method, is use a 3rd party program (since Apple doesn't have this easily built in, AFAIK).
NoSleep is a tool that permits you to keep your MacBook, MacBook Pro, or MacBook Air operating even after you have closed the lid. This can be particularly useful if you are the kind of person that needs to let your computer work while you are asleep or when you want to take your computer with you somewhere. It’s great for taking the computer places so that you can close the lid even though you want it to continue processing whatever it was processing when you had it opened up. It's also great for servers if you just happen to use your MacBook for one. If you use your MacBook as a base computer but like to attach it to an external display, then you will appreciate this application.
Again, if you decide to do this, be mindful of your temperatures and try to find an additional cooling method. Do not put your laptop in anything enclosed as you walk around/move positions, unless you like a block of aluminum with an usuable screen.