Fix InjectorServer socket closing

Closes #390