close some memory leaks involving nailgun

@yilongli please review

This pull request removes some major dominators that were keeping memory accessible long after the application had quit