Topological defects and geometric memory across the nematicsmectic A liquid crystal phase transition