This is just a style thing, but try blocks should be small.  I'd recommend moving this block to a function called something like `main_body()` and then the try would looks like.

```python
try:
    main_body()
finally:
    ...
```