fixed preprocessor directives

all references to file.h are only if USERPROG is defined
so that thread can be compiled on its own, as well as with those references
using #ifdef ... #endif