IN SSM: Improved exit status and write EndTime just if status == completed