Handle exception when saving empty file