Why two return statement are used?

I tried on leet code It’s optimising the solution with the return statement at last . Can someone explain why ?

vector generated ;
vector generateParenthesis(int n) {
allCombination("",n,0,0);
return generated;
}

void allCombination(string s , int n , int open , int close) {
if(s.length() == 2*n) {
generated.push_back(s);
return;
}
if(open < n ) {
allCombination(s+ “(”, n,open +1, close);
}
if( close< open ) {
allCombination(s+ “)”, n , open, close+1);
}
return; ---------------------- //// with this code optimise to 0 ms without this taking 12 ms
}