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

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