Fixed bug about saving text with last line missing; also multiple NLs.