Merge "Add flag to control whether wait application is killed" into main