People with strong religious beliefs appear to want doctors to do everything they can to keep them alive as death approaches, a US study suggests.