Geometric quantum phase in the spacetime of topological defects