You can keep the screen on when your MacBook or Windows laptop is closed by altering your laptop's power settings.
If your laptop enters hibernation while you're playing games, there's likely an issue with your battery or CPU giving out.