MDL-47649 csvlib: must not leave files open

I added a distructor to ensure the file is closed.

I also ensured that the gradeimport_csv unit tests did not hold onto a
reference to the csv object while the phpunit framework tries to tidy up
moodledata.

Finally, to stop CiBoT complaining, I fixed up the PHP4-style
declarations in the CSV import class.