MacBook won't sleep while charging
You may want to look into the sharing options as well as any other programs that may be keeping the computer awake.  If you exit all running programs (you may want to consider checking programs that are running in the background as well) and turn off all sharing under 'System Preferences' -> 'Sharing' and close the lid does it still exhibit the same problems.