termination of a twistd application in python
<p>I am trying to write an application with twistd library written for Python. The application file ends like the following:</p>

<p>factory = protocol.ServerFactory()</p>

<p>factory.protocol = EchoServer</p>

<p>application = service.Application("Echo")</p>

<p>internet.TCPServer(8001, factory).setServiceParent(application)</p>

<p>I want to run something before my appication terminates (e.g. close a file). Does anyone know how to do that? because this is an event-handler and I don't know where the clean-up function is called.</p>
