Fix potential infinite loop in LFWLoader

Tail recursion in getIfNotExists() will not terminate if there is an issue with network connectivity. Fixing that here.