Did you even read the original post.
Quote:

i'd like to be able to part a channel without closing the window


Did you try your code before you posted it, as the channel will still close when you part using that code.