I assume you’re drawing in the idle loop?
(I consider this bad Windows programming style in general, there are only very few excuses.)
I suppose all the clears are buffered and need to finish before the program can exit.
SwapBuffers seems to limit the amount of buffered commands, otherwise interactive content would lag too much.
Sorry, I have no idea what your trying to achieve.
Your code doesn’t contradict my previous post.
You send a glClear in the main event loop.
Fine, the OpenGL driver may be able to buffer many of those. If you don’t flush, finish or swap the OpenGL driver may still have a thousand clear commands to chew on until your program can exit.