Definitely get a UPS and it has to be one with a USB shutdown notification interface so that it can tell Windows to shut down cleanly and commit all io operations leaving the filesystem in a consistent state. This can’t protect you though from bad apps that do not do the right thing about listening for and correctly handling shutdown notification event messages from Windows.
If an app want to close a file with it only half written, or not even bother to commit recent changes, then that’s just a design flaw, and it can’t easily be fixed from the outside by a bandaid. Rather you would need to submit a bug report about any file corruption to the developers.
As for interrupted downloads, the downloaded should be downloading to a temporary file and then rename the temp file to the real filename once all downloading is successfully complete. Ether that or check the part-downloaded file to determine the true length and check that the partial download is not corrupt, then if all is well, ask the download server for the remaining part later to save having to do the entire download from the beginning all again. Many web servers can do this partial download. If this isn’t supported or the part file is corrupt then it has to be deleted and it’s time to repeat the whole download from scratch. But since it should merely be a temp file, then there’s no great loss. A pre-existing file that was due to be overwritten, if there is such a thing, will still be there, so it should be as if nothing ever happened. Developers with a clue do not ever download to the real required filename for this exact reason - things might go wrong.