fixed bug in _make_inheritable

it was trying to close a handle without checking if it
was an int *and* a long.