This is the crux of the matter. From what you describe it looks like your computer is struggling to run the live video compression fast enough. When Buffered is set to True, the frames are pushed into a queue and compressed in parallel so as not to disrupt the video acquisition process (i.e. to avoid frame drops). However, if your computer cannot encode frames at around the same rate as they are acquired on average, then you will end up putting many more frames in the queue than you are taking out. This is why you saw the RAM increasing, and eventually this will crash the computer.
If, on the other hand, you set the Buffered option to False, then Bonsai will indeed block the pipeline until each frame is completely written to the file. However, this means that while it is waiting for the video frame to be written it is not receiving any new frames from the camera, so you end up dropping frames which leads to the shorter durations in the video. The FrameRate you specify in VideoWriter is only really used for decoding of the video, the encoder doesn't know anything about whether you dropped frames or not, i.e. if in reality you acquired 20 frames / second over 2 seconds, then when playing back you get only 1 second at 40 fps.
If you don't want to have these gaps in the video, you need to turn Buffered to True. If your computer is crashing due to the RAM, then you have 3 options to try:
1) get a faster CPU / more RAM;
2) reduce the resolution of the video;
3) change the video codec
Which option is best depends on a number of factors including which exact hardware you have and what is the resolution of your video. There are a few posts in the forums already discussing this problem so it would be best to go over them and follow-up if there are questions.
Hope this helps.