Throw exceptions when closed file handles are passed in