Use writeFile instead of writeSync if password is different in database and controller