diff --git a/src/xpdev/wraptest.c b/src/xpdev/wraptest.c
index 570c32f80a9d69216bdd87fa96a3d8fa5fd45c81..1b424e7e619c4eb0ad4b88c4d3292f15c6eaf43c 100644
--- a/src/xpdev/wraptest.c
+++ b/src/xpdev/wraptest.c
@@ -301,8 +301,8 @@ static void sopen_child_thread(void* arg)
 			printf("!FAILURE: was able to reopen in child thread\n");
 		else {
 			SLEEP(5000);
-			close(fd);
 		}
+		close(fd);
 	} else if(arg==0)
 		perror(LOCK_FNAME);
 }
\ No newline at end of file