It works: migrated to the normal API (no C++ API)

Apparently the C++ Wrapper API automatically releases your OpenCL context upon destruction, probably according to RAII idiom.