'If there is an exception closing the file being written to after the
connection is prematurely closed, that exception is logged.'

def test_downloadPageLogsFileCloseError(self):

    class BrokenFile:
        def write(self, bytes):
            pass
        def close(self):
            raise IOError(ENOSPC, 'No    file    left    on    device')
    d = client.downloadPage(self.getURL('broken'), BrokenFile())
    d = self.assertFailure(d, client.PartialDownloadError)
    def cbFailed(ignored):
        self.assertEqual(len(self.flushLoggedErrors(IOError)), 1)
    d.addCallback(cbFailed)
    return d
