Removed incorrect handling ```toJSON()``` for empty collections

Hi,

This is awesome stuff, thanks! I did notice however some weird behavior when serializing empty collections. 

In that case, the result value is ```undefined``` where i expected ```[]```. Besides, ```toJSONInProgress``` (set to ```true``` on line 1499) is not being set to false, making future calls to JSON impossible. This should fix that.