Free memory allocated for step and block stats
Clean up memory leaks from the write group structure