Optimized file saving