timer_context_manager.py fixed class version of context manager to handle errors