s4/test-libnet: Move LSA close handle function to a common location