What is the name of a game that cannot be won until it is over?
In some contexts, such a game is called a closed game. To understand the terminology, let I and II denote two players, and suppose that the players alternate indefinitely playing elements $m$ from some set $M$ of possible moves. If we imagine that the game is played for infinitely many moves, we obtain an infinite sequence of moves $(m_1,m_2,m_3,\ldots)$. Let $M^{\mathbb{N}}$ denote the space of such sequences.
This space $M^{\mathbb{N}}$ has a natural topology, namely the product of the discrete topologies on $M$. Suppose that the payoff set (set of move sequences that count as a "win") for player I is closed in this topology. This means that whenever player I loses, it is because he or she made a mistake (e.g. telling the secret, in your example) at some finite stage of the game, or because the game was simply unwinnable. On the other hand, if player I wins it is because he or she has forever avoided making mistakes.
I am stretching your example here by assuming that the players are immortal, in which case the only way to win is by keeping the secret literally forever. In this situation, the game is "over" when infinitely many years have passed. I think that this is the most interesting interpretation of the question; otherwise one could simply consider "taking the secret to the grave" as one of the possible moves $m \in M$, and this move has the property that playing it results in an immediate win for player I, which is not very interesting.
The next few paragraphs do not directly address the question, but help to explain why some people (e.g. set theorists) consider closed games to be interesting:
A nice feature of closed games (relative to infinite games in general) is that they are determined. This is known as the Gale–Stewart theorem. To say that a game is determined means that one player or the other has a winning strategy that prescribes the moves to make in any given situation in order to win. If player I (the player with the closed payoff set) has a winning strategy, that strategy can be described simply as "don't make any mistakes" where a mistake is defined as a move after which player II can force a win in finitely many moves.
The more interesting case of the Gale–Stewart theorem is when player I does not have a winning strategy. If the set $M$ of moves is finite, as in chess, then the lack of a winning strategy for player I means that there is some fixed finite number $n$ such that player II can force a win in $n$ moves (e.g. perhaps the starting position in chess is a mate in 73 moves for black, although this seems very unlikely.) Then a winning strategy for player II proceeds by always playing so as to reduce this number (e.g. mate in 72, then on the next move mate in 71, and so on until he or she inevitably wins.)
On the other hand, if the set of moves is infinite then the construction of a winning strategy for player II in the case that player I has no winning strategy is more complicated and involves transfinite ordinals. The issue is that, for example, if the possible moves for player I are $m_1,m_2,m_3,\ldots,$ it could be that making any of these moves leads to a win for player II, but making move $m_i$ allows player I to survive for $i$ many moves, so there is no fixed upper bound on how long it takes player II to win. In this case we would take the supremum and say that player II can force a win in $\omega$ moves. By always choosing moves that decrease this ordinal rank, player II always wins, because there is no infinite decreasing sequence of ordinals.