Beazer Homes swings to a loss in Q1