Fix possible null value returned from GetContext

when stopping listener.

@amoiseev-softheme, that's a bit another way to fix the same problem of D-24329, but with our crutch of deadlocks.
Bad idea, if exit from the while when ctx == null and not listening, then we'll have null ref exception below on line 273.
Please find new pr https://github.com/Dell-AppAssure/mono/pull/12