Yes you can come back as soon as your family visit visa has been processed. This is based on my personal experience. I resigned from my job, cancelled my work visa, exited the country, waited for my family visit visa to be processed and was back in Doha in less than 10 days. When I got back, my hubby processed my family RP and voila I am now under his sponsorship and legally working (with working permit/labor card). Good luck:)