In general Macs do not open network ports or have services running unless either they are absolutely necessary e.g. DNS lookups, or you turn the relevant service on. So the first thing to do is check your File Sharing settings. Based on your description it sounds like File Sharing is enabled (ticked).
- Go to System Preferences
- Click on Sharing
- Click on File Sharing (on the left)
- If needed unlock the padlock in the bottom left
- Then click the options button on the right
If 'Share files and folders using SMB' is ticked this will cause NetBIOS to run and use those network ports and also likely port 445
If 'Share files and folders using AFP' is tucked this will cause Apple File Sharing to run and use network port 548
It sounds like you want to un-tick the SMB option.
You may also want to make sure the built-in Firewall is turned on since you seem to be concerned about network security.
- Go to System Preferences
- Click on Security & Privacy
- Click on Firewall at the top
- If needed unlock the padlock in the bottom left
- Turn the Firewall on (if it is off)