Q:

network capture program that writes network capture file even when being shut down unexpectedly

1) I am trying to do long running monitoring of my network connection using my desktop computer but if the computer gets shut down without first properly exiting the network monitoring program then the .cap file gets corrupted and I am unable to pull useful data from it. 
2) I am looking for a network monitoring tool (like Wireshark, or Microsoft Network Monitor, etc) that will successfully write a (non-corrupted) capture file to disk even if the application is killed inadvertently.  The capture program might die inadvertently due to the machine running out of RAM, a system crash, a reboot caused by Windows Update or some other reboot, etc.  Basically, the program will need to either stream the data to disk as a .cap file as it is received, or possibly use a different file format - perhaps something that is human readable like a text file so that even if the file is technically corrupted I will still be able to read it myself via a text editor. 
3) Using a capture "chain" where the chain files are small does not work for me because I need to see the very last little bit of data.  Capturing most of the data but then losing the last bit of data does not get me what I need.  I need to be able to inspect the last bit of data that is sent over the wire to see if that data is what is causing the crash / reboot. 
4) Alternatively, a tool that can successfully take a corrupted .cap file and fix the file would also work. 
5) I can't use a network device to monitor the traffic, the solution needs to be software that runs on a Windows 7 64bit desktop computer. 

A:

Use tshark and setup tshark to frequently switch to a different new file.   This way you don't lose your entire capture, but possibly just a small portion of the more recent stuff.   There are many options to set how often a new file should be used. 
Then simply read in or merge all the files together as needed when doing analysis. 