Teardown freed the view port before unhooking the serial and status callbacks, which run on the BLE/BT thread and call view_port_update. A late notification or status change during exit could touch freed memory. Unhook both callbacks and restore the default profile first, then free the view port.