Only call close if there's already a writer, which avoids flushing packets before the first call.
Attach a file by drag & drop or click to upload