Writes gains to CSV on sell