My computer was shutting down unexpectedly when I put it to sleep. I fixed this problem by going to Choose what the power button does. Then I set it to Shut Downand saved it. Then I pressed the button and the computer shut down. After turning it back on, I went back to Choose what the power button does and switched it back to Sleep. now it works for me!
This might have fixed the problem for you and I don't doubt that is a possibility -- but keep in mind that coincidence might also be a possibility here: We've already seen that this problem can be inconsistent at times...