If there is no window with a higher number then the window with the lowest number will be used. If there is no window with a lower number then the window with the highest number will be used. To close a window you should simply end all the processes which you started from within the window, usually ending the last started process first. Most shells also allow termination with a 'c-d' but this may depend on a setting for that shell. But you should make sure that this won't cause any harmful effects.
Screen quits automatically when there is no more window to be managed.
This happens when the process of the last window ends. So to quit you must end all running processes which were started. But this is very dangerous as you might lose unfinished work. Please RTFM to find this command yourself. Detaching a session is like putting down a book - you remove it from the view and put it onto a table.