Metadata stuff for file transfers. Some minor fixes.
File transfer thread & locks