Simply learn yourself.
For Safari

Can't shut down computer, safari quit failed

If you are Enable to shut down computer and safari browser fails to quit then you need to go through this instruction page to resolve the issue. Most Mac user rely on safari browser to access internet as it is the best browser among other alternatives.  Just follow the below mentioned steps to resolve the issue.

Note:  Your current work may not be saved if you perform these troubleshooting steps

Step 1: If you are trying to reboot or shut down your Mac computer and it display message “something is running in safari, and computer can’t close it automatically”.

Step 2: Go to apple logo and click on it.  Choose force quit and Select safari.  Hit on force quit to terminate the safari browser.

Step 3: Now, you have to shut down the computer.  Just hold the power button, it will take the Mac computer to power off mode. Turn on the system and open safari browser. Type the address of the website in address bar.