For performance reasons, data to be written to files is often stored in
memory buffers. When the buffers are full, they are flushed to the
file on disk.
If the computer crashes (for example from a power failure), data in the
buffers will likely be lost.
If the computer goes through an orderly shutdown, you can catch this
event and flush the StreamWriter, causing the data to be written to the
disk.