Add shutdown_fn to state machine