States scramble to close legal loopholes squatters use to take homes from owners