Stop playback and recording on rerender and close