throttle.py: Make sure opened files are closed properly
throttle.py: Make sure opened files are closed properly

Previously, if there was an IOError during file opening, the
file would not have been closed.

Bug: T95111
Change-Id: I6af4adae0e731cbcc8ff0c002b7d188f4e874520

magul/pywikibot-core,Darkdadaah/pywikibot-core,wikimedia/pywikibot-core,happy5214/pywikibot-core,jayvdb/pywikibot-core,wikimedia/pywikibot-core,PersianWikipedia/pywikibot-core,npdoty/pywikibot,hasteur/g13bot_tools_new,hasteur/g13bot_tools_new,hasteur/g13bot_tools_new,Darkdadaah/pywikibot-core,jayvdb/pywikibot-core,magul/pywikibot-core,npdoty/pywikibot,happy5214/pywikibot-core