Fix/remove comparisons of arrays against 0.
Ensure that the file is closed if there's an error while copying.
Handle some ftell() calls returning EOF.