Do I capitalize and depreciate closing costs on a cash-out refi used to put a new roof on my rental property?

I own a 2-family home, my family lives in one of the units and I rent out the other. Half of many expenses are deducted on schedule E for the rental portion of my property (ie. real estate taxes, mortgage interest, etc.)

I needed a new roof and siding so I refinanced my mortgage and received cash back from the available equity in order to pay for it. I received $40k in cash back which paid for the improvements, there were appx. $10,000 in closing costs, of which $4k were "fees" related to loan origination, appraisal, title, recording, etc. (the rest were prepaid taxes, interest and insurance and the initial escrow). 

Since 50% of the costs were allocated to the rental portion of my property, I plan to capitalize the $20k for the roof and siding improvement and depreciate over 27.5 years. But, how do I handle the closing costs? Specifically the $4k in fees? Is this added to the cost basis of the improvement (increasing the improvement from $40k to $44k, the rental portion being $22k) and depreciation adjusted accordingly? Or, can I expense these fees in the year they were incurred? Or, are they only good for offsetting potential future capital gains (in the event I ever sell the property)? Any help would be greatly appreciated.