Fix end of loading if promise failed