Only open the configspec when needed and close it after use