Fix a file descriptor leak when using an invitation.