Um, don't use goto

And not just because everyone says so. In this *particular* use (as with a very many other uses), it makes the code harder to read and understand. Just use return, its not so bad to duplicate the close function call - its probably actually more performant this way since you're not jumping code.