For that reason I’d consider a subscription (we discussed the major apps here) that protects real-time against threats like ransomware.
EDIT: And if you want a free option that handles ransomware, it seems that the well-regarded Avira utility offers that in its free tier. (Review.)