Here's a version that gets rid of Options and vars

```scala

  private def readSplits(splitFile: String, conf: Configuration): Array[TileIdWritable] = {
    val splitPoints = new ListBuffer[TileIdWritable]
    val splitFilePath = new Path(splitFile)
    
    val (iterator, close) =
      splitFilePath.getFileSystem(conf) match {
        case localFS: LocalFileSystem =>
          val localSplitFile = new File(splitFilePath.toUri.getPath)
          if(!localSplitFile.exists)
            (Seq[String]().iterator,{ () => })
          else {
            val scanner = 
              new Scanner(new BufferedReader(new FileReader(localSplitFile)))

            val iterator = 
              new Iterator[String] { 
                def hasNext = scanner.hasNextLine
                def next = scanner.nextLine
              }

            (iterator, { () => scanner.close })
          }
        case fs =>
          if(!fs.exists(splitFilePath)) {
            (Seq[String]().iterator,{ () => })
          } else {
            val fdis = fs.open(splitFilePath)
            val scanner = new Scanner(new BufferedReader(new InputStreamReader(fdis)))

            val iterator = 
              new Iterator[String] { 
                def hasNext = scanner.hasNextLine
                def next = scanner.nextLine
              }

            (iterator, { () => scanner.close ; fdis.close })
          }
      }

    try {
      while(iterator.hasNext) {
        splitPoints +=
          TileIdWritable(ByteBuffer.wrap(Base64.decodeBase64(iterator.next.getBytes)).getLong)
      }
    } finally {
      close()
    }
        
    splitPoints.toArray
  }
```