title: writeJSONString don't fill my file
body: <p>this simple piece of code create an empty file despite I try to write the json into a file.</p>
  
  <pre><code>import java.io.{File, FileWriter, IOException}
  
  import org.apache.http.client.ClientProtocolException
  import org.apache.http.client.fluent.Request
  import org.json.simple.JSONArray
  import org.json.simple.parser.JSONParser
  /**
    *  * Created by Administrator on 02/01/2018.
    */
  object Test {
  
    def main(args: Array[String]): Unit = {
        val res = "[{\"price\":\"100\",\"bookName\":\"Java\"}]"
        val jsonParser = new JSONParser
        val json = jsonParser.parse(res).asInstanceOf[JSONArray]
        val file = new File("myjson_" + System.currentTimeMillis / 1000 + ".json")
        val writer = new FileWriter(file)
        json.writeJSONString(writer)
        println(json)
      }
  }
  </code></pre>
  
  <p>When I run It, as I said below, the json is empty. I have tried to replace my jsonArray containing 1 jsonObject to a JsonArray containing 500JsonObject. I get only 482 records and the last one is truncated. Do you have any idea or do you obtain the same result??</p>