Fix code not being run if exceptions were rescued
Extract cache cleanup to method