Hi,
you can store the status of the workflow in an instance variable called running in an advanced Javascript Code activity and a Wait activity like this (don't forget to set your variable running to false at the end of the workflow) :

Kind regards,
Pierre