Different behaviour in 12.04 and 14.04 when laptop lid closed with external monitor
Solution 1:
I believe this is a bug, and the only solution is to set your options to "Do Nothing".
Quite simple really
go to System Settings
Then click on Power Settings
Set the When the Lid is Closed
options to Do Nothing
You can now close your lid and your laptop will not shutdown.
If your external monitor goes black just move your mouse or click mouse button and it should turn back on, and your external monitor will now be your primary display.
PS. You should also file a bug report for this issue.