Remove unused packages from NuGet packages config
Ensure the listener exists before stopping it on close