Save file to disk implementation