I tried to write to a binary (\*.bin) file and I met a problem.
When I use the following code, it does not write anything to the file:

```
abc = str.encode("sabd")
f=open("sbd.bin",'wb')
f.write(abc)
f.close

```

However, when I use the following code, it works well:

```
abc = str.encode("sabd")
with open("sbd.bin",'wb') as f:
    f.write(abc)

```

I use Win + Python3.