Loading dialog doesnt close automatically