I don't think it has to do with spyware or viruses.
What firewall are you using? Windows firewall? Your router
firewall?
If it's these 2, it could be that they are buggy. All these are
Windows processes, if they stop working, your computer would crash
until you restart. If it's other firewalls, can you post a
screenshot of your error if possible?