anchor.diff:          checkUserIdExists.setString(2, oldUser);
           ResultSet rset = checkUserIdExists.executeQuery();
           if(rset.next()) {
  -          //Notify user that the new user name is already taken! And go back to previous page.
  -          out.println("Your new username:" + uid + " already exists! \n Try again please.");
  +          // Notify user that the new user name is already taken! And go back to previous page.
  +          checkUserIdExists.close();
  +          out.println("Your new username: " + uid + " already exists! \n Try again please.");
             System.err.println("New USER_NAME already exists!");
           } else if (!rset.next()) {
  +          // New username is unique and ok to be used.
             
             // Password hash and salt will be set to original if no new password.
  -          if(newPass.isEmpty()) {
  -              System.err.println("0");
  -              
  +          if(newPass.isEmpty()) {              
                 // get old password, salt, and email
                 updatePassword = mCon.prepareStatement("select U.PASSWORD, S.SALT, P.email from USERS U, SALTS S, PERSONS P where U.USER_NAME=S.USER_NAME and P.PERSON_ID=U.PERSON_ID and U.USER_NAME=?");
                 updatePassword.setString(1, oldUser);
  
positive.code:           insertPersons.setString(3, address);
            insertPersons.setString(4, phone);
            insertPersons.setInt(5,personId);
            results.add(insertPersons.executeUpdate());
            
            System.err.println("3");
            
            if(oldUser.equals(uid)) {
              System.err.println("uId no change");
              // no userID change
              updateUserId = mCon.prepareStatement("UPDATE USERS set PASSWORD=?, ROLE=?, PERSON_ID=? where USER_NAME=?");
              updateUserId.setString(1, hashed);
              updateUserId.setString(2, role);
              updateUserId.setInt(3, personId);
              updateUserId.setString(4, oldUser);
              results.add(updateUserId.executeUpdate());
              System.err.println("4");
            } else {
              System.err.println("uId change");
              // userID is changing too.
              updateUserId = mCon.prepareStatement("INSERT INTO USERS (USER_NAME, PASSWORD, ROLE, PERSON_ID, DATE_REGISTERED ) SELECT ?, ?, ?, ?, DATE_REGISTERED from USERS where USER_NAME=?");
              updateUserId.setString(1, uid);
  
negative.code:           if(!oldPID.equals(personId)) {
              PreparedStatement delOldPerson = mCon.prepareStatement("DELETE FROM PERSONS where PERSON_ID=?");
              delOldPerson.setString(1, oldPID.toString());
              delOldPerson.executeUpdate();
              delOldPerson.close();
            }
            
            // Email unique constraint. If changed: update it, and also update when an insert due 
            // to new pid copy because email unique constraint, otherwise email would be empty.
            if(oldEmail == null || !oldEmail.equals(email) || !oldPID.equals(personId)) {
              emailUpdate = mCon.prepareStatement("UPDATE PERSONS SET email=? WHERE person_id=?");
              emailUpdate.setString(1, email);
  