Fixed memory leak with Cuda context manager