Make sure that close() is called even if commit or rollback fails.