Massive KWin lag after closing any OpenGL application

Hello,

If you use that, then you must also have the kwin.sh file. See here an example:

Also try this settings for compositor:

Are you on KDE Plasma or KDE Plasma GIT, and what nvidia drivers version have you installed?