Freeing memory allocated for AIK after writing