Fixes the IOExecption non-serializable when application is put in the background.