Update write_cache function

no empty cache files should be generated if SteamAPI times out