Why does my water turn into a cube at the end of the simulation?
There can be several reasons to this.


If there is no fluid in the domain (possibly because of an outflow), it will display the domain mesh.
The simulation is not baked to the last frame of the scene. Once a simulation is baked (it uses the scenes start and end frame) it stops at that frame. Increasing the end frame would result in some unsimulated frames, the simulation has to be run again.
The fluid particles may be too small or too few in the domain. When the fluid falls below the minimum size (specified by the simulation resolution), it display the domain mesh. If you have many tiny drops, which you want to simulate, you need to increase the resolution.


The solution is to hide the domain in the viewport and in the render.
To hide the domain mesh from the last simulated frame onwards, animate the Restrict Render and Restrict Viewport visibility. This way, you can hide the domain mesh on certain frames.



Step 1: Go a frame where domain is still simulated. Hover over the Restrict Render property in the outliner and press I to set a keyframe. (Same with the Restrict Viewport visibility property.)

Step 2: Go to the first frame, from which on you want to hide the domain.  Disable Restrict Render and Restrict Viewport visibility and keyframe them again.