My MacBook Pro doesn't sleep when lid closed
This is expected behavior and it’s called clamshell mode. With an external display and mouse/keyboard, closing your laptop lid allows you to continue working on the external devices. The momentary blackout is due to switching graphics modes. To put the machine fully to sleep, simply choose Sleep from the Apple menu.