curvetun: Only close() file descriptor if open

Only attempt to close the file descriptor in error cases where it is
actually open.

This was discovered by the coverity scanner.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>