Now when a program wants to create a socket, it creates a process that listens to a pre-defined port of choice.
As mentioned in this thread Manually close a port from commandline, the socket is bound to the process that created it. Meaning it would automatically be freed, when the process terminates. With I guess cports (the program you referred) esentially does.
Now you could use the built-in program in windows "netstat" to get a list of reserved ports, and the id of processes that keeps them open.
Take a look at this link Check Open TCP/IP Ports in Windows.
There are multiple ways to run a program, and then get the 'std output' for further processing. Here's a link that shows how Execute a Command in C#.
Summary: (My immediate approach would be...)
Make a call from C# to netstat, get the id, from the port of your interest. And the call "Taskkill /PID the_id /F".
Give it a try, hope it works for you.