If your system isn't on a UPS and there's a power glitch, then program files and data can become corrupted. These units not only allow me time to shut programs down safely and then shut down the computers normally, they also protect the hardware from hard spikes and sags we get all the time. When a motor is turned on, for example, this sends a power wave back down the line that can spike the power after causing a sag when the motor is initially turned on. Lightning hitting a pole will send a large spike of voltage down the line that will wipe out everything in its path. A UPS can protect from that because they have a grounding bar and large thyristors in them to soak up the current. Generally, though after a direct lightning hit, you'd want to replace the UPS anyway but it did take the hit for your equipment.
In addition to power hits, Windows updates can wreak havoc if you don't have Windows notify you of an impending restart and then it restarts the computer on you. As a rule, I check for updates prior to doing anything with my computer to mitigate the chances of being interrupted by a message and then have to shut down Trainz or other programs to complete the restart. You can also wait then until you are done or until you shut down and install the update then.