Yes, you can leave the country (I did the same). They will ask you whether you have traveled internationally after the interview on the day of the oath ceremony so you have to inform them where you went and for how long.
The oath letter will have an area on the back where you'd write where and when you traveled. You'll hand that in at the oath ceremony. If you left the US for several months after the interview, they may remove you from the oath.