Closing the terminal will kill all processes launched from its shell instance that are still running. Here is how to detach a running process and run+detach a new process:
Scenario 1:
Let’s say we have ./long.sh
running, and we want to detach it:
./long.sh