Not sure how it's causing your symptoms, but this line:
req.session.user = new.user;
should likely be:
req.session.user = newu.user;
UPDATE
The root of the problem is that creating the directory is triggering nodemon to restart the app and the default in-memory session store loses all sessions when that occurs. The fix is to use a persistent session store like Redis via connect-redis.