fixing bug where finally is called before the returned future from a previous then resolved