Infected belly piercing???

So i went to the doctor to check my piercing and i was told that it was indeed infected and to take the piercing out and was prescribed antibiotics (cephalexin) and antibiotic ointment. I took the piercing out and it already looks closed but now im seeing everywhere online that I shouldn’t take the piercing out if it is infected?

Has this happened to anyone before? Dod u take the piercing out and everything was fine with the antibiotics? Im freaking out because im reading it can cause more complications and enter my blood etc.