diff --git a/editors/textadept/modules/dmd/dcd.lua b/editors/textadept/modules/dmd/dcd.lua
index 1081b64..0ead9fb 100644
--- a/editors/textadept/modules/dmd/dcd.lua
+++ b/editors/textadept/modules/dmd/dcd.lua
@@ -123,6 +123,7 @@ function M.autocomplete(ch)
 	p:close()
 	local tmpFile = io.open(fileName, "r")
 	local r = tmpFile:read("*a")
+	io.close(tmpFile)
 	if r ~= "\n" then
 		if r:match("^identifiers.*") then
 			showCompletionList(r)
diff --git a/editors/textadept/modules/dmd/init.lua b/editors/textadept/modules/dmd/init.lua
index 3302e79..6978bf2 100644
--- a/editors/textadept/modules/dmd/init.lua
+++ b/editors/textadept/modules/dmd/init.lua
@@ -20,7 +20,7 @@ local function autocomplete()
 	_M.dcd.registerImages()
 	_M.dcd.autocomplete()
 	if not buffer:auto_c_active() then
-		_M.textadept.editing.autocomplete_word(keywords)
+		textadept.editing.autocomplete_word(keywords)
 	end
 end