Thank you, J G. Calling cancelMktData(<ticker_id>) before calling disconnect() fixed the issue, both with live and paper trading.
I'll keep monitoring for error 10197 on the live trading account to check if it is still returned occasionally as you mentioned.
Thanks!