Added pipeline afterClose event which the user can use to do anything after pipeline closes. Added pipeline onError event to indicate that pipeline had errors after closing.