Stop applications properly when stopping infrastructure