For Windows, it is best to find the parent of the ffmpeg process and then send Ctrl+C using Win32 user interaction to it.
This way, it can really stop gracefully and not end up with a corrupt MP4 file.
I have made a solution for Windows here: https://github.com/Apivan/ffmpeg_stopper_win32