The flickering after closing the game might be related to this factorio bug report, as mods don't really have enough control over lower level rendering to cause that themselves.
https://forums.factorio.com/viewtopic.php?f=7&t=46754
It might be good to report this bug there to help the factorio devs fix it.
The out of Video RAM explanation the dev suggests makes sense for this as well, as the preview window is an entire new surface for factorio to render. You might be able to change the video settings to keep it from happening as often.
(and the flickering preview is probably compounding the issue causing massive VRAM swapping and the GPU can't keep up, but probably nothing modders can do about it).