How to _disable_ USB on STM32F1xx?
Disabling functional blocks as USB in a modern SoC is not something that is advised to be done on register level by user. The USB IP block contains several sub-blocks and interfaces between them: access fabric, core controller, FIFOs/SIPOs, PHY. All interfaces usually work with some handshake protocols that usually require some presence of clocks on both sides of the interface, so arbitrary mocking with clock control registers might result in deadlocks. Therefore it is strongly advised to use pre-designed functions (as SUSPEND) from software IP to manage USB block. The documentation says, in part:


  The OTG_HS interface has the following features: 
  ...
  - Powersaving features such as system clock stop during USB suspend, switching off of the digital core internal clock domains, PHY and
  DFIFO power management 
  ...


and


  Device suspend When the device detects a suspend condition on the USB,
  the library stops all the operations and puts the system to suspend
  state (if low power mode is enabled by in the usb_conf.h file).


Therefore, to accomplish the power savings task, I would strongly advise to use already developed functions from STM USB library.

ADDITION: The STM package seems to have a limitation that the suspend or disconnect modes cannot be forced by user firmware. Here is an idea: After the device function is finished, switch the OTG controller into HOST MODE. But then don't proceed with initialization of the HOST function, or shut the HOST function down. It might result in fully disabled USB block.