When should I say I'm leaving my PhD program
This is an interesting question and it’s really more about ethics than academia. 

I’m absolutely sympathetic to your position. You started your degree in good faith and have had a change of heart. 

If I were in your position I would probably give them notice 1 month before you intend to leave. Is that the ethical thing to do? No. I think, ethically, you ought to tell them now, but as you say it may cause you financial trouble. 

One thing you might do to mitigate your sense of taking advantage of the program is to be a good community member for this last semester. Help other students out. Volunteer for things when there is an opportunity to do so (like organizing seminars or even at the university level, like peer counseling) That way you can feel like the university is getting something back. 

Another option is to be honest and then if you get cut off just get a job to pay your rent until your lease is up. Your PhD stipend can’t be so high that it would be impossible to find a job of equal pay.