Removed unused code; closed streams.

Closed file streams opened in copyFile.
Removed unused "int i" in a few methods.