Fixes #1196: Files cannot be copied with FileIO

The FileIO writer was altered to remove duplication and re-use library
code to reduce maintenance but a side-effect was that files could
no longer be copied.

This commit implements the solution as suggested by @marcimat and
re-enables the copying of files.
Merge pull request #1200 from mvriel/hotfix/1196

Fixes #1196: Files cannot be copied with FileIO