Add tryCatch to put_variable
Add tryCatch to write functions (see issue #7)