Closure properties of function spaces