Function to kill a process running on a given port