Cosmological perturbation theory in non-flat universes