Fix bugs.

* Core didn't reuse the pipe if it already existed.
* The conditional statement to associate magnets and torrents was inverted.