Had the same problem on the exact same machine. Here's how I solved it. It turns out that at some point, the sleep light indicator cable had been routed in front of the lower case's latch mechanism, rather than on "the inside" of the latch (towards the laptop's guts I mean). Just the extra thinness of that cable pushing against the latch was enough to keep the hooks on the lid from achieving strong enough contact with the latch built into the bottom case. Re-routed cable, and presto. Never had another problem with the laptop staying shut.