Studying Magnetic Fields and Dust in M17 Using Polarized Thermal Dust Emission Observed by SOFIA/HAWC+