This may be outside the scope of this pull request:

Could `to_fasta` be implemented as a generator that yields fasta records (strings)? This call is effectively reproducing the full alignment in memory (in fasta format) and then writing to file.