Tried to address the issue that blocks the CloseDevice call.