There are 2 potential resource leaks in CloudWalUploader due to file handles not being closed:
- file_object is not closed
- wal_file is not closed
When CloudWalUploader is run in a one-shot call from the CLI, the leak is not noticeable.
However, when run in sequence from a single process, if the Python gc doesn't trigger in a while, then the handles are leaked.
In our case, this leads to a handle exhaustion in our WAL uploader service.
PR: #1129