Updated to only close loader when the branch needs to be selected.