Update websocket close methods to be asynchronous
The close methods for websockets were updated to be asynchronous. This change was necessary to better handle the closing of active websockets both in the try/finally block and in the terminate method. The asyncio event loop was also employed to ensure all pending tasks are completed before closing.