Fixed some problems dealing with the detection of unclosed objects or arrays as well as with the pressence of unnecessary trailing commas in arrays and objects