Better validation on what file to write to.