Properly close javascripts block and remove superfluous endblock