Closing a program with the ‘x’ button is typically OK but nit typically the preferred method.
Most programs will have an internal ‘quit’ process.
The ‘x’ is actually part of the window api that the program resides in.
If the program is truly in an unresponsive state, the window close feature will not always close the program.
Using taskmanager or similar gui app you can get a more manageable list of running processes.
Killing the program is not exactly the same as stopping it.
Stopped programs are still in ram and can be restored to run state. Occasionally this will rescue the process allowing the program to finish its task.
Killing a program will quite literally yoink it from ram and free up all the resources associated with it.
However this introduces opportunity for data corruption on open files. Among other factors depending on what the program is supposed to do.
Taskmanager is simply a graphical version of the commands tasklist and taskkill.
Tasklist displays all running processes,
while taskkill kills the process you supplied the pid or process identification number for.
Taskmanager literally uses both of the commands behind the scenes.
How x differs is if the program uses a hook to read the window x button state and if it overrides the window api to initiate its own internal shutdown process.
Such as close open files, finalize running tasks, store a resume state in a tmp file, return a physical device to its wait state.
The last item is typically a printer but could be anything.
Like machinery, recall a drone, or put a lid back on the reactor.
Where as if you kill the process you could cause unpredictable problems that might not be desired.
Ref Chernobyl.
Killing a process maybe the only solution at times and the decision should be made with the consequences in mind.
That said if you’re ever using your computer and get a message pop up that is strange, ie
Windows has determined that you have a security issue and to please call ### to solve.
That is probably a good time to just kill the process or yoink power to the pc.
Because clicking on the x will more than likely be hooked to an internal shutdown sequence in the process that generates a code and encrypts your hard drive.
Aka ransom ware.
Please refer to preferred method of shutdown.
Latest Answers