What Harold said. We have a setting, and strongly recommend to use it, to record in MKV instead, which contains the exact same data but with a different header structure.
MP4 uses a header that specifies everything about the data, including its size, which of course can't be known until the recording is told to stop and then allowed to finish its housekeeping. If you just kill it, or the system hangs or crashes, or possibly your battery ran out, you lose the entire file. It might be possible to recover it with specialized tools, but that's pretty much it, and the chance drops off a cliff if you do anything else at all with that storage device in the meantime, which includes an operating system running on it.
MKV, like I said, has the exact same data in it, but a different header that does not need to know anything that can't be known ahead of time. So if that gets interrupted, it's like running out of tape on an old reel-to-reel machine. Everything before that point is still there just fine.
If you record in MKV and you really need the MP4 header or file extension, OBS has a tool to do that, and can even be made automatic. It goes really fast because, again, it's the exact same data, bit-for-bit. Only the header is different.