The ending is stored
A file holds the ending bytes you wrote. Nothing converts them for you, so a mixed file is a mixed file.
Read tolerant, write plain
Read with splitlines so either style works, and write one style you state. That combination survives a move between machines.