*Trigger Warning* Sex after miscarriage

I’m really worried. I had a miscarriage last week and thought I had stopped bleeding so we had sex. My doctor told me to just wait after I stopped bleeding to have sex. After sex, I started bleeding with clots again. I’m worried that this will lead to an infection. What should I do?