Optimized metadata writing by adding caching of BufferedWriter objects.