accessibility: ensure that the stream is cleaned up before the method returns

Change-Id: Ib46d24be831b5c9bda0582bd7064f34528e1d609
Reviewed-on: https://gerrit.libreoffice.org/11938
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>