You can't close the aperture to see the actual set value through the viewfinder. However, since you'll be shooting a nearly-static (slowly moving) sun, you can use Live View or Video mode to focus.
- Set the camera to manual mode
- Set the lens and body to manual focus
- Select your aperture, say, f/22.
- Enter either Live View, or start video recording. This will stop down the aperture, and show a live view on the display
- Assuming the sun isn't blown out (and of course, the presupposes your solar filter is on), set your focus. You can zoom in and shift the edge of the sun on your screen to help you nail focus.
- Tape the lens focus ring to the barrel to minimize focus shift if you accidentally brush against the lens later.
Note that if you change aperture setting during or after step 4., you'll need to leave Live View or video mode, and start over at step 3 again.
This is because once the D3x00 and D5x00 series bodies stop down the aperture, they can't mechanically open it back up until the shutter fires and the shutter curtain completes an entire cycle. Entering Live View or video mode stops down the aperture and opens the shutter curtain, but until the shutter curtain resets to trigger position, the aperture cannot mechanically open up. This is an inherited design from film SLRs. Before Live View and video, there was no need to allow the aperture to open during film plane exposure. It was originally a strictly mechanical interlinkage system, that Nikon continued to use in its bodies until mid- and higher-end DSLRs were designed with electronically-controlled aperture capability.
See Why is it not possible to change Aperture in Livewiev on a Nikon D5300 when using manual movie settings? for more.