[dataimport] better file handling when importing a CSV

This PR refactors import_csv into two methods:
    - import_csv_file which will take a file name, and open that file using with...open and then calls import_csv_data
    - import_csv_data which takes a stream to read