I recommend:
```Python
with open(ShivaConfig.queuePath + key, "wb") as goodData:
    goodData.write(garbledData[match.start():])
```
As soon as you leave the with block, the handle will be closed automatically.