Explain how you would optimize a Python script that is running out of memory while processing a multi-gigabyte CSV file.