Yes, of course, the file would get there closed. Asynchronous celery
tasks run in a completely separate process (moreover, they can even run on
a different machine) and there is no way to pass an open file to it.
You should close the file in the process from where you call the task,
and then pass its name and maybe position in file (if you need it) to the
task and then reopen it in the task.