Ayatollah Ali Khamenei’s remarks upend months of signals from Tehran that it wanted to negotiate over its rapidly advancing nuclear program.