1. Click on the Windows button in the bottom left (or Center), and type in 'Change what closing the lid does'

2. Under the 'Plugged in' column, choose 'Do nothing' from the drop down menu in the 'When I close the lid' row.
3. Make sure to save your changes.