Search for gamma-ray spectral lines with the Fermi Large Area Telescope and dark matter implications