IIRC the game ends as soon as (in a 2 player game) the 4th contract is claimed - i.e. the fourth card is taken from the map. That number varies on player count. I may be wrong.
The game ended is triggered when The number of contract cards that have been claimed from the table equals two more than the number of players in the game. (Ex. 6 cards for a 4P game.) You can only claim a new contract card after you have completed a secondary contract on your currently active contract card.