Fix issues that GroupBy and Sample doesn't call 'unsubscribe' and also NPE when the key is null in GroupBy

Fix #1958
Thanks, the code makes more sense now with that requirement. Might worth checking Window for this as well.