Added missing file close on test command