A dismissal without prejudice in either state or federal court is not a final judgment given res judicata effect if the dismissal is entered after a demurrer has been sustained or motion to dismiss has been granted with leave to amend and the dismissal is filed within the time allowed for amendment.