When your PC made a restart, press 'F8' and then choose 'Safe Mode'. Check after that from there if the PC would continue to restart or not.
If it stopped, then it's indeed a virus.
If not then it might be a hardware issue and let's say it would be your RAM. Opening or closing a window is an instruction from windows that passes to the RAM to be executed.
When your PC made a restart, press 'F8' and then choose 'Safe Mode'. Check after that from there if the PC would continue to restart or not.
If it stopped, then it's indeed a virus.
If not then it might be a hardware issue and let's say it would be your RAM. Opening or closing a window is an instruction from windows that passes to the RAM to be executed.
Hope this will help ...