Security experts say that if your computer has been infected with malware, you shouldn’t restart it. Instead you should turn off Wi-Fi, power off the computer, and start looking for IT help (via ZDNet).
Don’t Reboot
A recent survey (n=1,180) [PDF] of U.S. adults shows that 30% restarted their computer to deal with malware. But sometimes that can actually help the malware. Bill Siegel, CEO & Co-Founder of Coveware said:
Generally, the [ransomware] executable that actually encrypts your data is designed to crawl through attached, mapped and mounted drives to a given machine.
Sometimes it trips, or is blocked by a permission issue and will stop encrypting. If you reboot the machine, it will start back up and try to finish the job.

Credit: Simoiu et al.
This is most apparent in cases of ransomware. Ransomware encrypts your files and then the hacker will tell you that they will decrypt their files for a fee. If you restart your computer the encryption process will just pause, then keep going once your computer is fully powered on.
Further Reading:
Mac ransomware? Which one? When did it hit? How many people?