Ibuprofen 400 and pregnancy ?

I'm scared because my tooth was hurting me and I went to the dentist and He prescribed me ibuprofen 400 m and to remove my wisdom tooth so I took ibuprofen every 6 hours for about 3 days and I stop because I was feeling a little dizzy and nauseous so I took a pregnancy test and it was positive.. And I was reading that ibuprofen can cause miscarriage ... And I lost 2 already and I'm so scared ... Can anyone told me is this is true ?