Javascript: Finalizers being called