split_fasta.py: open files in text mode

Also make sure that file handles are closed, either by using the open() call
as a context manager or by explicitly calling file_obj.close().