Added function to select an address and close the window in one operation.