Yes, that would work, as would not downloading random files, opening everything you download in an isolated VM first, only downloading open source software, examining the code of the downloaded file yourself before running it, and so on.
The best cure is, of course, not gambling with the security of your system by opening and running unknown files and apps. I wrote in a different thread recently that malware can be configured to recognize and "escape" the secure enclosure of a VM or sandbox as well. Even that isn't something to rely on nowadays.