ts-appsrc: Fix deadlock during shutdown
The IO Context has to be alive longer than the other parts of the state. Otherwise a deadlock can happen between shutting down the IO context (thread join while the state lock is held) and stuff happening on the IO context (which might take the state lock).