Move CSV export to the background task system

Shapefile and KML export to follow.
Requires some extra environment variables (see sample.env).

/cc @hampelm