A convenience function to interact with the document in block and automatically invoke close at the end.
The R value returned from block