I don't use this approach so I cannot answer to the actual problem but one thing that stands out to me is that you're responding to the event that the download has started and you're hooking up to get notified of state changes. But you are in a race condition at this point. It is quite possible the download has already completed before you even hook up the event handler. This is always a risk when trying to handle events after a process has started. In this case I don't see that you have any other choice since you need the download to start in order to get to the event you need to handle. But I'd recommend that after you hook up the state change handler that you then check the current state of the download. If it is already completed then you won't get the state change notification (because it happened before you hooked it up) so you need to do your completion logic.
Hook up event handler for state change Check to see if download is already completed
Note that you are still in a race condition here. It is possible that the download is in progress when you hook up the handler, it completes and your event handler gets called and then you check the state. You need to handle the case where you are trying to "complete" the download when you've already completed it. The inverse also applies. If you were to check the state first and then hook up the state change handler then it is possible for it to complete in between these two calls.