Added qobject-alive-p
Added check to change-tab to fix closing condition.