Relaxation of residual stresses during curing of polymer matrix composites