Don't attempt to close nil channels

This avoids a crash when attempting to close a nil Channel. A stack trace of the problem can be seen here: http://pastebin.com/HEb7Duiy

I have no idea if this is the truly proper solution, or if there's a deeper bug, but this permits my program to run as it should, and return an error code to the caller, rather than crashing.