Mac doesn't sleep when lid is closed, but upon opening the lid it falls asleep?

The SMC controls things like sleep, fans, etc. Reset the SMC by following the instructions here: http://support.apple.com/kb/HT3964

EDIT: In case that link dies, you restart the MacBook Pro while holding down these keys on the left side of the keyboard: Ctrl + Option + Shift