Port twisted.python.logfile to Python 3
Close opened file to remove spurious warnings on Py3

Warnings such as:

    ../twisted/internet/utils.py:199: ResourceWarning: unclosed file <_io.TextIOWrapper name='twisted.test.test_logfile/LogFileTestCase/test_maxNumberOfLog/hj855e/temp/test.log' mode='w+' encoding='UTF-8'>
        result = f(*a, **kw)