What is the meaning of [Close but no cigar]

In the old days, fairgrounds would give cigars as prizes for games. The phrase “close but no cigar” means that you were close to succeeding in the game, but you didn’t win the cigar. As a proverb it means that even though you did your best or almost had it right, you weren’t completely correct.