the softwares are responsible for opening or closing of the ports.until and unless u don't know the software responsible for the opened port you can't close it. u can close ports by uninstalling the softwares which open the ports.