It depends on demand for the game, how long they have the license for the theme, if both parties are interested in renewing or not to extend production, and how many games they may have been contracted to make under the license agreement. There's probably a few other factors in there as well.
There really isn't a set amount of time or a specific number for each title.
Quoted from Patrunkenphat7:Looking at games like Ghostbusters and Batman 66 which have been out a couple years but are either only recently finished code or still unfinished.
Code updates aren't related to what's happening (or not happening) on the production line. Updates released whenever a programmer has time to work on them. Sometimes even well long after a game has ceased production. A lot of times, it can be a programmer's passion project.
Quoted from Patrunkenphat7:Follow-up question is if NIB machines dry up almost immediately following the production end for a particular game.
Not always. It depends on demand for the game. Sometimes distributors have a small stockpile for a while after production ends.