1. Find the service pid number corresponding to the port.
Netstat -anlp| grep port number
2. In the last column of the above command, the pid number of the application corresponding to the port will be given.
Kill -9 pid can close the service and close the port.