Because you will pay interest, taxes and insurance from the day you close, you would probably prefer a closing that dovetails with your present lease or mortgage so that you won't pay expenses on two different places for part or all of a month. On the other hand, you may want a few days with the new house vacant, for painting or other projects.
If you're placing a new mortgage, you'll be asked to prepay interest for the rest of the present month, to bring you up to the lender's usual "first of the month" bookkeeping. That means if you close early in the month, you'll need that much more cash. It isn't really an extra cost, of course, because you'll own the property from that day on. Still, between that and the rent you're paying, you might prefer to buy toward the end of the month.
You won't, by the way, need to make any mortgage payment on the first of the next month because mortgage interest is normally paid in arrears (the opposite of in advance). Close in June, prepay interest up to June 30th, and you won't owe any July payment because that would have been for use of the money during the month of June, and you paid that at closing. Your first payment will be due in August and will cover July's interest.