Changed SerializeCorefData so it writes to file after every query it processes