Add verification of context state in __dealloc__.

If the context is closed but not the deleted and
Socket.__dealloc__ is called by the garbage collector
exception are thrown when executing the _check_rc
function.
Merge pull request #566 from cmd-ntrf/dealloc_bug

Add verification of context state in Socket.__dealloc__.