Generating curvature perturbations in a contracting universe