@Override
		public void windowClosing(WindowEvent arg0) {
			/*TODO
			 * Put this into a separate (static?) function to be
			 * called upon an exception that terminates the game
			 * so as to prevent database clogging up
			 */
			
			System.out.println("window closing");
			
			//TODO find way to go around this problem (i.e. deleting the file within ImageGenerator when not in use...)?
			
			// delete card0file
			Path path = Paths.get("card0file");			
			try {
			    System.out.println("DELETING "+path.toString());
			    Files.delete(path);
			} catch (NoSuchFileException x) {
			    System.err.format("%s: no such" + " file or directory%n", path);
			} catch (DirectoryNotEmptyException x) {
			    System.err.format("%s not empty%n", path);
			} catch (IOException x) {
			    // File permission problems are caught here.
			    System.err.println(x);
			}
			
			try {
				if(mg.getMySQLAccess().getConnection().getWarnings() == null) {
					mg.getMySQLAccess().connect();
				}
				mg.getMySQLAccess().removeUser();
				GameManager.getMatchesAccess().removeGame();
			} catch (Exception e) {
				e.printStackTrace();
			}
			
		}