save buffer to local