fix race condition on device state destroy