If you are trying to avoid a penalty for an early withdrawal, you will be asked if you used the money to purchase a first-time primary residence, you will be asked if you used the money or that purpose. Say Yes, it does not matter that the closing will come in 2018.