Don't destroy code and do check right brackets

First a generic solution to the recurring problems with destroying code in autocorrect. Don't know why I didn't think of this earlier.

Then an addition in two cops to make the autocorrected example from #1118 look nice. Please check if my rules for where to put the right curly/square bracket are good. They are based on what we've used in the RuboCop source code. Or should these checks be in new cops?