Use OGR#get_driver_by_extension in OGR#get_writer