Prevent MemoryError when concatenating large files