Put another way:

A port is a device (virtual) used for making a connection. Each device is assigned a number. A port scan is the act of testing these devices to see if they are in use

A port is only ‘open’ when a service is using it. The only way to close a port is to turn off the service.

Rather than turning off services, which is not always possible, you can make these services unreachable from the internet or reachable only to selected computers by the use of a firewall.