what does “memories are like corks left out of bottles…“ mean?

Except for those with perfect recall, most of us have memories which are highly colored by the emotions of the moment. After the fact, our changing emotions re-form the memories and they take on a shape of their own. These re-constituted remembrances often do not compare perfectly with the original "cork" of memory, or even fit the bottle of reality.

Most memories have some kind of emotion associated with them: Recalling the week you just spent at the beach probably makes you feel happy, while reflecting on being bullied provokes more negative feelings.

-MIT.News

This is mostly due to the interactions of the hippocampus and amygdalae.

The amygdalae, a pair of small almond-shaped regions deep in the brain, help regulate emotion and encode memories—especially when it comes to more emotional remembrances.

_Dana Foundation

The amygdala and hippocampal complex, two medial temporal lobe structures, are linked to two independent memory systems, each with unique characteristic functions. In emotional situations, these two systems interact in subtle but important ways. Specifically, the amygdala can modulate both the encoding and the storage of hippocampal-dependent memories. The hippocampal complex, by forming episodic representations of the emotional significance and interpretation of events, can influence the amygdala response when emotional stimuli are encountered. Although these are independent memory systems, they act in concert when emotion meets memory.

-National Library of Medicine