Shutdown will cause the system to try to gracefully close all the applications or services that are loaded. Applications will get notified that this is happening and given a short grace period to "make good their escape".
The next part of the shutdown process will trigger the operating system to tell the filesystem drivers to flush their stored data to the storage device. This should cause the filesystem driver to sanitize the filesystem prior to shutdown.
It will also then tell the drive that the filesystem is on to flush whatever hardware caches they have to disk.
If, after all that, there is still data locking the disk then it is tough luck as the system will simply shut down. If an application has refused to save its data or release it correctly then it is simply lost.
What OS are we talking about? What will happen automatically depends on the OS. What requires a user to intervene will depend on the OS. – Ramhound – 2017-11-30T17:46:34.920
At the moment, Linux, but I am interested in both answers. The problem is I don't know how an OS can forcefully exit a process in, as the first answer, a 'too bad' case, to shut down, yet no user requested kill can kill it. It happens in windows and linux both that a file handle might lock things, and the only solution is a restart. – J Collins – 2017-11-30T17:48:09.130
In most cases commands only attempt to do something, after that period of time, specific or unknown behavior can happen. – Ramhound – 2017-11-30T17:49:36.913
keep in mind, a "mount point" is a memory structure within the kernel memory structure that is overseen by kernel and userspace software. regardless of what the rest of the software thinks about it, the kernel can always destroy that memory structure. it just won;t under most circumstances to protect the integrity of the filesystem from bad events caused by bad software or bad users. Its not like a process exists beyond the point where the kernel wants it to exist. its all just state management. – Frank Thomas – 2017-11-30T18:06:00.853