added support for close event
removed unnecessary lines
Merge pull request #21 from colkito/fix/on-close-peer

added support for close event