Fixed a bug where the recording stopped working when the app goes in background.