Fix file handle leak in webgateway file download