Added possibility to write buffers to files.