How do not lock/sleep MacBook when you close the laptop lid?
To enable laptop sleeping with closed lid: 

sudo pmset -b sleep 0; sudo pmset -b disablesleep 1


To re-enable laptop sleeping: 

sudo pmset -b sleep 5; sudo pmset -b disablesleep 0