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

Fix #1958
I believe we should have the same behavior for groupby and window, so I followed the discussion in #1546.