Tax withholding while selling primary residence on H1B

Hi, 

 

I am on H1B and in USA for the past 14 years with approved I-140. I am in NJ for the past 13+ years and I bought a primary residence (condo) in 2017-March and have a 30-year mortgage on the same. Now I am planning to sell the residence. I am reading different articles that for a non-resident alien, 15% of the sale price needs to be withhold with IRS as part of closing.  I took the mortgage with 5% down. In case my sale price is not atleast 10% more than the bought price, am I suppose to borrow this money and pay IRS? I know I can claim this money back as part of my tax returns but since we are at the start of the year, I still need to borrow this money for a full year. Any other alternatives are possible here?

 

I am reading in some places that for the tax purposes, I am resident alien as I am staying in USA for more than 6 months or so. Please advice. 

 

Regards,

Surya Kiran.