Stop processing messages before ending the WebSocketFunc Task

- This should prevent ObjectDisposedExceptions from WindowsIdentity
  in OnDisconnected
Added test to verify that WindowsIdentities are usable in OnDisconnected