Keep in mind that according to the rfc this \n.\n business only applies to text files, and almost always it will not matter whether or not the file has a \n.\n at the end.