Thor Industries said it swung to a quarterly loss amid soft recreational-vehicle demand and spending to streamline the company, but it stuck by its outlook for the full year.