Add spec to ensure error is thrown on double-close.
DRY up the tests by moving shared code into TestHelpers.js.