If exception hits, make sure it's closed.