Are you privy to the conversations between CBS /Paramount and their show runners? For all we know they were absolutely prepared to end the show after season 4, but Goldsman might have begged them to give him some more episodes to satisfactorily end the series, and they were good enough to grant him that.
Don't forget Secret Hideout in all of this. I'm sure they had some say.