Clear ID before closing EventSource

Fixes #1519