Fixes a resouce management issue with the Twisted API.