SPARK-1830 Deploy failover, Make Persistence engine and LeaderAgent Pluggable

I was just suggesting that we could do

```scala
val out = serializer.serializeStream(new FileOutputStream(file))
out.writeObject(value)
out.close()
```

It's a very minor point about ByteBuffers not always having a valid array().