Optimized the shutdown process

When closing Tiled it checks whether any maps need saving and it also
saves the currently selected layer and view position. In doing so it was
making each of the open maps "current" twice, which causes all the
panels to update and is generally much more work than actually needed.

Now making maps current is avoided except for the case where the user is
prompted about whether he wants to save any changes, to make sure the
context of the question is clear.

Tiled now shuts down instantly, even with many maps open. It can be a
little disturbing at first.
Lua plugin: Write out image layer properties

Closes #435
Merge branch '0.9'
Lua plugin: Escape special characters when quoting strings

Now \, " and newlines are correctly escaped when quoting strings in
the Lua output. I hope that covers all cases.

Closes #437
Merge branch '0.9'
JSON plugin: Resolve relative paths of image layers

Relative image reference of image layers were not being resolved by the
VariantToMapConverter, leading to images not being found when the map
location didn't happen to match with Tiled's working directory.

Also made sure the path is cleaned from "./" or "../" parts.
Merge branch '0.9'
Merge github.com:bjorn/tiled