ANSWER:

You can leave anytime you want but you will lose the reward of praying the whole night if you leave without completing the witr with them. 

In our masjid there is 20 rakaat taraweeh + 3 raakat salatul witr in jamaat. If I attend the taraaweeh jamaat, do I have to stay with the jamaat untill it ends or may I leave anytime I feel like leaving?