Ringgit ends firmer amid weaker US dollar