Internally, the system will close all sockets when entering listening mode, so that might provide some kind of stop-gap solution, but it doesn’t feel like a good solution, just one that works!
Is there any reason why the firmware app cannot clean up the sockets it creates?