ST defect fixes and review comments fixes

Change-Id: Ib8c56a88c19cd9aa23918d0f9e37c89e74cb0d13
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
index 7181a62..271d698 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
@@ -104,7 +104,7 @@
      */
     public static void appendFileContents(File toAppend, File srcFile) throws IOException {
 
-        insertStringInFile(srcFile, UtilConstants.NEW_LINE + readAppendFile(toAppend.toString()));
+        updateFileHandle(srcFile, UtilConstants.NEW_LINE + readAppendFile(toAppend.toString()), false);
         return;
     }
 
@@ -133,18 +133,23 @@
     }
 
     /**
-     * Insert content to the generated file.
+     * Update the generated file handle.
      *
      * @param inputFile input file
      * @param contentTobeAdded content to be appended to the file
+     * @param isClose when close of file is called.
      * @throws IOException when fails to append content to the file
      */
-    public static void insertStringInFile(File inputFile, String contentTobeAdded) throws IOException {
+    public static void updateFileHandle(File inputFile, String contentTobeAdded, boolean isClose) throws IOException {
         FileWriter fileWriter = new FileWriter(inputFile, true);
         PrintWriter outputPrintWriter = new PrintWriter(fileWriter);
-        outputPrintWriter.write(contentTobeAdded);
-        outputPrintWriter.flush();
-        outputPrintWriter.close();
-
+        if (!isClose) {
+            outputPrintWriter.write(contentTobeAdded);
+            outputPrintWriter.flush();
+            outputPrintWriter.close();
+        } else {
+            fileWriter.flush();
+            fileWriter.close();
+        }
     }
 }