PlasmaWindowManagement::windows is only updated after PlasmaWindow object is destroyed. And unmappedCallback emits unmapped, then deleteLater on the PlasmaWindow. This may cause having invalid data in the app state if two window from same application quit at the same time. With unmapped signal, it is not possible to always get the up to date data from ::windows().
Change it to listen on the QObject destroyed signal and comparing with pointer value instead of uuid, because uuid is not available at the point of QObject::destroyed, also it is possible that window has no valid uuid on certain system.