What's your definition of "originated" vs. "closed"? You report the application in the calendar year you took action (originated, denied, etc.). I'm not sure how you can originate a loan in Oct 2017 and close it in 2018.
If it closed/originated in 2017, then you follow the 2017 rules (HI before refinance). If you closed/originated it in 2018, it's refinance before HI (and the new 31 / 32 break out).