Replace System.getProperty("line.separator") to System.lineSeparator()
fixed stream close by AutoCloser.