Fixed bugs in .closest()

Bugs:
 1. Trying to find a Document or DocumentFragment as a closest node would always return no results
 2. NodeCollection#closest() would sometimes return a NodeCollection containing duplicates

Other Notes:
- As a side affect, this fix improves performance of Node#closest()
- Removed helper function that was only used in one place after the fix and just inlined that code into the function that was using it