Set the NotOpenError error code also for closing

Change-Id: Iacf0235bd64bca8fbe4e2ce2c652cd89d3136b2f
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>