I recommend writing this the following way:
```Python
with open(docpath+'/htdocs/'+rqfilename, 'rb') as f:
    payload = f.read()
```
As soon as you leave the `with`, Python will close the file handle. `'rb'` is the recommended mode to open a file handle.