fix leak when open fails