Added comments to clarify the buffer management in the file save process. This enhances code readability and maintenance.