How can I record a video without it getting corrupted?

It seems the issue was me stopping the capture of my video. My blueprint node to exit and quit the game only worked in the editor and not in the recording video so I had to open up the console and type in exit using '. The problem was fixed.