The above should be moved in a ``finally`` block to be safe (and you may also want to check for null before calling ``close()``)