Properly unsubscribe Layer events 

I've just bumped into this while browsing the source code. It's not tested in any way and I didn't look for similar issues in other files neither. But I hope it helps anyway.
Merge pull request #3084 from miroslavraska/patch-1

Properly unsubscribe Layer events