Open output file in 'w' mode instead of 'wb'.
Switch to getting default layer by its index (0).

We used to get it by name, but with GeoJSON files, the layer's
name has no relation to the filename on disk.