You can kill a process using the kill command. You can use lsof with -n to see the processes that have connections to a file. So, here, you can see lsof showing all files with an open connection:
lsof -n
You can also use the-c option to constrain output to a specific string. The kill command can then use the lsof command to kill all those processes, as follows:
kill -HUP $(lsof -n -c /tty/i -t)
Free your files…