Linux gives processes a chance to gracefully close. However, it also will absolutely NOT allow a process to hang up the shutdown or restart procedure after a point. If you're using systemd (which there is a good chance you are), it'll count down. If the process hasn't stopped in the time allotted, it gets Old Yellered.