Effects of pion potential and nuclear symmetry energy on the π-/π+ ratio in heavy-ion collisions at beam energies around the pion production threshold