Use gmtime instead of localtime, fix blanking of sensors file on error