The code returns the following error:
[browser] ⨯ unhandledRejection: InvalidStateError: Cannot close a closed AudioContext.
Revise the code to address the error.