Update: after restarting my system/ mac the problem has disappeared, but i seems liket this issue came back as I have had the same issue before and in the mean time, my system was restarted multiple times.
Intermittent issues like yours are typically the result of a buggy graphics driver or failing hardware.
You're on Mac, so it's less likely a problem with a graphics driver (which you can only update by updating Mac OS), but you could try setting Preference > Performance > Use Graphics Processor to Off for a while to see if that's the cause (and if it is, wait for a new release of Mac OS to update the driver).
It could also be intermittently failing memory or disk. Google for how to run hardware diagnostics on Mac, especially for memory.