Destroying CUDA context cause core dump

In my program I encode frames form 2 different sources in 2 separated threads. First is a video file and second is video from decklink capture device. I create for each thread, CUDA context, and when I finish and goes to destructor for the first thread, it cause core dump. The second thread is affected by destructor of the first thread. If I delete lines cuCtxDestroy(m_cuContxt) the program is closed correctly. Why the CUDA context destruction affects the capture device memory of second thread?
Here is a part of my destructor code:
cuCtxPushCurrent(m_cuContext);
cudaFree(m_cvt_color_src_ram);
cudaFree(m_cvt_color_dst_ram);
cuMemFreeHost(m_pinned_frame_memory);
// Check for CUDA errors
cudaError_t cudaErr = cudaGetLastError();
if (cudaErr != cudaSuccess) {
std::cerr << "CUDA error before destroying context: " << cudaGetErrorString(cudaErr) << std::endl;
}
// No need to pop context destroying it pops it implicitly
cuCtxDestroy(m_cuContext);

Thanks,
Alona.B