Merge of (#10582) to Vaadin 7.

Ensure SQL connections etc. of FreeformQuery are closed.

Change-Id: I5488510ef7d752e8e743408e0f60acf483e45fc1
Merge "Merge of (#10582) to Vaadin 7." into 7.0