So, is it ok to withdraw IRA funds just before the house completion
and actual closing, although the contract has long been signed?
Forgetting about the IRA aspect for a moment.
Normally when the seller accepts your offer for an existing house you make a deposit into an escrow account to show how committed you are to completing the deal. The money in that escrow account is then part of the exchange of funds on the date of the closing.
When buying a new house there is a similar mechanism. The only difference is the timeline. Sometimes the builder won't even start construction for several months after the contract is signed.
In either scenario the bulk of the money for closing costs and the down payment on the mortgage, are only gathered in one place a few days before closing. It is not unusual for CDs to be cashed a few days before closing. Sometimes the money needed at closing only becomes available when the bu=yer sells another property.
Now back to the IRA...
There is no need for you to pull the money from the IRA until just before closing. Don't cut it too close because the IRA may send you a check and want several business days to get the check to you. Don't do it too early or you may have a problem if there is a last minute delay in closing.