Repository: pytorch
Issue: Tensorboard SummaryWriter with cloud storage does not work on Mac
Labels: oncall: visualization

### 🐛 Describe the bug

I have been trying to use google cloud storage with the Tensorboard logger in pytorch lightning, but it seems to do incomplete writes. I created an example using SummaryWriter that produces the same results.

I have been able to confirm this is working fine on linux.

I am aware that underlying this may not be pytorch issue, but haven't been able to isolate the tensorboard logic, nor have I been able to setup tensorflow on mac to test this. I would appreciate some help with isolating the issue further if the issue is in tensorboard or another library.

Dependencies:
`pip install tensorboard torch gcsfs numpy`

```python
import numpy as np
from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter("gs://test-bucket-124/summary_writer_test/")
r = 5
for i in range(100):
    writer.add_scalars('run_14h', {'xsinx':i*np.sin(i/r),
                                    'xcosx':i*np.cos(i/r),
                                    'tanx': np.tan(i/r)}, i)
writer.close()
```

Open tensorboard:

`tensorboard --logdir gs://test-bucket-124/summary_writer_test/`

Result:
<img width="391" alt="Screenshot 2023-01-31 at 10 55 48" src="https://user-images.githubusercontent.com/1589858/215727823-85af3574-a01f-411a-8a07-447011aeeb32.png">

Expected:
<img width="378" alt="Screenshot 2023-01-31 at 10 59 04" src="https://user-images.githubusercontent.com/1589858/215728501-e761a0d1-043b-4686-8920-fb11b19e3d0e.png">


### Versions

Collecting environment information...
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 13.0.1 (arm64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.202)
CMake version: Could not collect
Libc version: N/A

Python version: 3.10.9 (main, Dec 15 2022, 17:11:09) [Clang 14.0.0 (clang-1400.0.29.202)] (64-bit runtime)
Python platform: macOS-13.0.1-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.24.1
[pip3] torch==1.13.1
[conda] efficientnet-pytorch      0.7.1                    pypi_0    pypi
[conda] numpy                     1.22.4                   pypi_0    pypi
[conda] numpy-base                1.21.5           py39hadd41eb_3
[conda] pytorch-lightning         1.9.0                    pypi_0    pypi
[conda] pytorch-sphinx-theme      0.0.24                    dev_0    <develop>
[conda] segmentation-models-pytorch 0.3.1                    pypi_0    pypi
[conda] torch                     1.13.0                   pypi_0    pypi
[conda] torchaudio                0.13.1                 py39_cpu    pytorch
[conda] torchdata                 0.5.0                    pypi_0    pypi
[conda] torchmetrics              0.9.3                    pypi_0    pypi
[conda] torchtext                 0.14.0                   pypi_0    pypi
[conda] torchvision               0.13.1                   pypi_0    pypi
[conda] torchx                    0.3.0                    pypi_0    pypi