test: Fix fd handling in test-profile
diff --git a/test/test-profile b/test/test-profile
index 2aa8d71..2d66444 100755
--- a/test/test-profile
+++ b/test/test-profile
@@ -4,6 +4,7 @@
 
 from gi.repository import GObject
 
+import os
 import sys
 import dbus
 import dbus.service
@@ -25,7 +26,9 @@
 	@dbus.service.method("org.bluez.Profile",
 					in_signature="oh", out_signature="")
 	def NewConnection(self, path, fd):
+		fd = fd.take()
 		print("NewConnection(%s, %d)" % (path, fd))
+		os.close(fd)
 
 if __name__ == '__main__':
 	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)