All drivers updated? Sony support website should have it all. Vaio Update also works. Look for something like "Extension Firmware Parser Patch" and "Vaio Control Centre Update".
In control centre under "what to do when lid is closed" set it all to do nothing and see what happens. If you have switchable graphics it may the driver that's crashing when using internal display. As a last resort discrete graphics can be disabled in BIOS.
All else fails just send it back to sony.
Also, when it shuts off, is the power light flashing or is it off completely? Sleep mode and shut down look really similar