added missing flush

added missing flush which was causing the export to be truncated by a
few lines. This fixes and closes #6. This can be verified here

http://biocache.ala.org.au/archives/dr341/dr341_ror_dwca.zip
refactoring of media downloads

refactoring of media downloads