Use clFinish instead of clFlush + clWaitForEvents