fix file descriptor leak in s3fs_truncate()
fix memory and file descriptor leaks in put_local_fd
use the mutex'd curl functions properly in readCredentials