Update lib/basicAuth.js

Fixing a "Error: Can't set headers after they are sent." bug