Open up cmd.exe (note: you may need to run it as an administrator, but this isn't always necessary), then run the below command:
netstat -ano | findstr <Port Number>
(Replace with the port number you want, but keep the colon)
The area circled in red shows the PID (process identifier). Locate the PID of the process that's using the port you want.
Next, run the following command:
taskkill /F /PID <Process Id>
netstat -ano | findstr 8080
TCP 0.0.0.0:18080 0.0.0.0:0 LISTENING 19788 TCP [::]:18080 [::]:0 LISTENING 19788
taskkill /F /PID 19788
SUCCESS: The process with PID 19788 has been terminated.