Avoid calling Unref on a closed port

Fixes #21
Add some tests for opening ports
Merge pull request #44 from drewish/safe-double-close

Avoid fatal error when closing unopened port