SOLR-4914: Close OutputStreamWriter properly, use System.getProperty("line.separator") instead of \n Fixes Windows test failures.