redefining ```f```. is this supposed to work (with close() in finally?)