Are you having this problem in your browser, windows itself, or what?
After you size the window however you want, try holding down the shift key when you close the window. If that doesn't work, try going to the File menu of the window and selecting Exit or Quit or whatever is there rather than clicking the X button (also try holding Shift while doing this).