check_swap - free library resources at the end

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>