implemented closing