You can close a query by using the Close command on the Windows menu, the tab's context menu, or by clicking the cross on the right hand side of tab strip. If the query has not previously been saved you will be prompted to save it to file.
When there are multiple windows open you can close them all by selecting Close All from the Windows menu. When there are several unsaved queries open you will get a prompt that allows you to quickly save all files. This dialog will only prompt you to enter file names for previously unsaved files.
In addition to closing all windows you may wish to close all but the one that is currently active. Use the Close All But Current command from the Windows menu, or the tab's context menu.