You could probably still claim it as your main residence for up to 6 years after moving out, but you wouldn't be able to claim the new house as the main residence during any overlapping period.
Best to look at the legislation
http://www.austlii.edu.au/au/legis/cth/consol_act/itaa1997240/s118.145.html
There is a clear example at the bottom where someone moves out then in again and then out again.