The small index property for free groups and relatively free groups