You can leave Canada and come back. The two-year period is cumulative. You need to reside in Canada for 730 days out of a five year period.