Refactoring of write functions

* The write_vector function have been split into:
  - write_realsxp
  - write_intsxp
  - write_cplxsxp
  - write_lglsxp