Update library.js

Fixes 'Error: Can't set headers after they are sent.' error when publishing an article.