Task Generalization with Stability Guarantees via Elastic Dynamical System Motion Policies