Erratic MCU behavior while switching from wired to wireless UART
Could it be because DTR is floating when USB is unplugged,  and that is somehow implicated in reset of your MCU as is common in many Arduino designs?