This needs to be in a finally block or it might corrupt the state of this class.