Agree with Acorn. I don't think you will have any technical issues doing what you propose.
However, I think ethically you should disclose the situation to any prospective buyers. Which, unfortunately, will likely make it difficult to sell to anyone that doesn't know and trust you already.
Think about it like this: How would you feel if you purchased phone not knowing there was an outstanding payment plan attached, and then decide to change carriers and can't unlock it?
Or worse yet, even though you have good intentions, what if an adverse financial situation befalls you and you can't make the payment, or miss it for another reason. The buyer would then have a bricked phone through no fault of their own. They should be informed about this risk before purchase, IMO.