This happened many times.
While the SSH active, I'm so tired and just close the terminal without
Is it dangerous to doing like that?
Not at all. When the terminal process exits, the client processes within will also die, and when this happens, the connection to the remote server will be closed by the operating system. The server will see the connection close, and terminate the processes on the server.
However, it is possible that you might end up with lingering processes on the server if they were backgrounded and ignore certain signals.
When we closes the terminal directly, It generates a SIGHUP signal. This signal kills all the tasks/processes under the terminal automatically/instantly. So no problem occurring.