Add tests for handling of 'close' messages