This function closes the file associated to the ephemeris descriptor eph, and frees all memory allocated by the functions open/create functions. After this call, the ephemeris descriptor eph is no longer valid.

The following example creates a new ephemeris file ephemeris.bsp

USE, INTRINSIC :: ISO_C_BINDING
use calceph
TYPE(C_PTR) :: weph

weph = writeph_spk_create("ephemeris.bsp"//C_NULL_CHAR, "asteroid_1"//C_NULL_CHAR)
if (C_ASSOCIATED(weph)) then

     ! ... compute and write to weph ...

     call writeph_close(weph)
endif