Improved check of target validity

Also relative links now works
Gracefully shutdown the database
Updated changelog