added a test case for closing after sending