opencl_write_kernel_file: add error handling