The tileQueue might have entries again after zooming when the previous zoom level hasn't finished loading yet. Removing the check for the tileQueue's length makes layers report loadend correctly again.