A properly sized UPS (Uninterruptible Power Supply) will provide enough power for your equipment to continue running through a short power interruption. Most have software which will automatically save and close any open files and applications and soft shutdown your computer.