Sometimes you have to initialise more than one resource and properly clean everything up.
This is the cleanest option I was able to figure out for Kotlin.
Example of usage:
private val buffers: Array<AudioBuffer>
private val device: AudioDevice
private val context: AudioContext