Guard against NPE in LocalRemoteRepo.close() and make it idempotent.