changes in _onCloseHelper

.parents starts search from first parent, but we need to start from current element.