Add functions that will be called during end() e.g. for handling error conditions without having the same code all over the place.