The lid switch might have oxidized or dirty contacts...
If you manage to sleep it sometimes by slapping it it means shaking = forcing contacts works.
If you manage to sleep it sometimes by slapping it it means shaking = forcing contacts works.