Fixed bug in cleaning of owned windows on disconnectwhere a double increment was causing elements to be skipped.