Fix resource leak in sqlfs.js
Finally sort out requirejs circular dependency horror