My OS closes down after 5 seconds of inactivity (with the alert pop-up)
That window appears if you hit the power button, maybe your power button is faulty and thinks you are hitting it. This also would explain why this problem "auto-solved" itself without you doing anything (i.e. there was some dirt "triggering" the click, and it went away).