Thread safe file handler