Optimal Reset Strategies for Mitigating Malware Epidemics