Fix leaking and better opencl event handling