It's "almost" working now.

The program is correctly allocating memory and writing to disk asynchronously, but it's sometimes crashing when creating new cv::Mat() objects somewhere down in the openCV source.

Did a quick check, and in 1/1 cases it was when a thread had both allocating and writing tasks. However it only crashed the 4th time after the thread had both tasks