Delete buffer from our own list before closing it
Delete buffer from our own list before closing it

When we close a buffer, weechat invokes a callback so we can unregister
the channel. However, when we close the buffer ourselves in the
unregister function it caused the unregister function to be called
again. By deleting the buffer from our list first, the second invokation
of unregister won't find the channel, so the rest isn't run again.

This prevents an error from weechat when we sent None into buffer_clear
because the channel_buffer had already been set to None.

Also does some cleanup. Use global EVENTROUTER, check if channel exists
instead of catching exception and remove some unnecessary checks.

rawdigits/wee-slack,wee-slack/wee-slack,trygveaa/wee-slack