Why does my MacBook Air (almost) always lock when I shut the lid?
If you close your laptop then immediately reopen it does it lock itself? also in the settings it specifies that it will not lock after "sleep or screen saver begins." Which means what may be happening is that your MacBook is passed a sleep state and has entered standby mode and locked itself. 

Side Note: Why would you want your mac not to lock itself. Closing the lid does not protect against potential attackers if you have this setting disabled. It also makes it harder to lock you computer when you want to.