how do i close the ports as you guys mentioned?
Port forwarding is set up on your router.
Usually you access the router admin by a web page at the router's ip address, eg 192.168.1.1
You can check your router ip address with the ifconfig command on the pi or ipconfig in a Windows command window.
If your pi, or perhaps your router did get hacked, you should check the user accounts on your other computers and change all passwords, including your WiFi one.
Maybe a factory reset on your router is a good idea too, but make sure you know the settings to reconnect to your ISP. And check if there are any firmware updates available for it.