They will not stop producing them until they are sure they can pull of BFR. The CTO has already said that Falcon 9 will be available as long as people ask for them.
By that point where they can no longer produce F9 they plan to have a fleet of Falcon 9 on the books that could continue for quite a while.