Does it function after restarting the power? If so, then it's just your R4, no, more like everyone's R4, as it only happens on certain games. When you shut your cover, the game still "goes on," but it still processes, and if you leave it there for a while, it freezes up, especially on games that require high specifications.
That's the way I see it, someone more professional should be able to explain it a lot better.