Fix requiring an error-throwing module twice

If a module throws an error then the exports created for it should
be deleted, so that if the module is required a second time the error
is thrown again, instead of an empty exports object being returned.