When to Refinance?

Dealer gave me a crappy rate, I already called a re-fi company I trust and they’re half the rate! So when is the right time? I just bought the car this month, is it too soon? What will it do to my credit to open one loan, close it, and open another so close?